Method: HsdsTransformer::BaseTransformer#transform_file

Defined in:
lib/hsds_transformer/base_transformer.rb

#transform_file(input_file_name, file_mapping) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/hsds_transformer/base_transformer.rb', line 52

def transform_file(input_file_name, file_mapping)
  path = @input_path + input_file_name
  org_mapping = file_mapping["columns"]

  # Now we want to process each row in a way that allows the row to create multiple objects,
  # including multiple objects from the same rows.
  CSV.foreach(path, headers: true) do |input|
    collected_data = hsds_objects_from_row(input, org_mapping)
    collect_into_ivars(collected_data)
  end
end