lib/generators/taxon_works/batch_load/templates/interpreter.tt
# TODO: THIS IS A GENERATED STUB, it does not function
module BatchLoad
class Import::<%= model_name -%>::<%= interpreter_class -%> < BatchLoad::Import
def initialize(**args)
@<%= table_name %> = {}
super(**args)
end
# TODO: update this
def build_<%= table_name %>
@total_data_lines = 0
i = 0
# loop through rows
csv.each do |row|
i += 1
parse_result = BatchLoad::RowParse.new
parse_result.objects[:<%= table_name.singularize %>] = []
@processed_rows[i] = parse_result
begin # processing
# use a BatchLoad::ColumnResolver or other method to match row data to TW
# ...
@total_data_lines += 1
rescue
# ....
end
end
@total_lines = i
end
def build
if valid?
build_<%= table_name %>
@processed = true
end
end
end
end