Class: Import::Otus::SimpleInterpreter

Inherits:
BatchFileLoad::Import
  • Object
show all
Defined in:
lib/batch_file_load/import/otus/simple_interpreter.rb

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ SimpleInterpreter

Returns a new instance of SimpleInterpreter.

Parameters:

  • args (Array)


4
5
6
# File 'lib/batch_file_load/import/otus/simple_interpreter.rb', line 4

def initialize(**args)
  super(**args)
end

Instance Method Details

#buildArray

Returns:

  • (Array)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/batch_file_load/import/otus/simple_interpreter.rb', line 9

def build
  return if !valid?
  @processed = true

  @filenames.each_with_index do |name, file_index|
    objects_in_file = {}
    objects_in_file[:otu] = []

    file_content = @file_contents[file_index]
    otu = Otu.new({ name: file_content})
    ap file_content
    objects_in_file[:otu].push(otu)

    @processed_files[:names].push(name)
    @processed_files[:objects].push(objects_in_file)
  end
end