Class: Import::Namespaces::SimpleInterpreter
- Inherits:
-
BatchLoad::Import
- Object
- BatchLoad::Import
- Import::Namespaces::SimpleInterpreter
- Defined in:
- lib/batch_load/import/namespaces/simple_interpreter.rb
Instance Method Summary collapse
- #build ⇒ Boolean
- #build_namespaces ⇒ Integer
-
#initialize(**args) ⇒ SimpleInterpreter
constructor
A new instance of SimpleInterpreter.
Constructor Details
#initialize(**args) ⇒ SimpleInterpreter
Returns a new instance of SimpleInterpreter.
5 6 7 |
# File 'lib/batch_load/import/namespaces/simple_interpreter.rb', line 5 def initialize(**args) super(**args) end |
Instance Method Details
#build ⇒ Boolean
45 46 47 48 49 50 |
# File 'lib/batch_load/import/namespaces/simple_interpreter.rb', line 45 def build if valid? build_namespaces @processed = true end end |
#build_namespaces ⇒ Integer
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/batch_load/import/namespaces/simple_interpreter.rb', line 10 def build_namespaces @total_data_lines = 0 i = 0 namespaces = {} # loop through rows csv.each do |row| i += 1 parse_result = BatchLoad::RowParse.new parse_result.objects[:namespaces] = [] @processed_rows[i] = parse_result begin namespace_attributes = { institution: row['institution'], name: row['name'], short_name: row['short_name'], verbatim_short_name: row['verbatim_short_name'], delimiter: row['delimiter'] == '' ? nil : row['delimiter'] } namespace = Namespace.new(namespace_attributes) parse_result.objects[:namespaces].push namespace @total_data_lines += 1 if namespace.present? # rescue TODO: THIS IS A GENERATED STUB, it does not function end end @total_lines = i end |