Class: CsvMapper::Importer
- Inherits:
-
Object
- Object
- CsvMapper::Importer
- Defined in:
- lib/csv_mapper/importer.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#map_fields ⇒ Object
readonly
Returns the value of attribute map_fields.
Instance Method Summary collapse
-
#initialize(params, options) ⇒ Importer
constructor
A new instance of Importer.
- #raw_data ⇒ Object
Constructor Details
#initialize(params, options) ⇒ Importer
Returns a new instance of Importer.
7 8 9 10 11 12 13 14 15 |
# File 'lib/csv_mapper/importer.rb', line 7 def initialize(params, ) @file_handler = CsvMapper::FileHandler.new() if @file_handler.save_temp_file(params[[:file_field]]) set_attributes_from_valid_file() else raise CsvMapper::MissingFileContentsError end end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/csv_mapper/importer.rb', line 4 def filename @filename end |
#map_fields ⇒ Object (readonly)
Returns the value of attribute map_fields.
4 5 6 |
# File 'lib/csv_mapper/importer.rb', line 4 def map_fields @map_fields end |
Instance Method Details
#raw_data ⇒ Object
17 18 19 |
# File 'lib/csv_mapper/importer.rb', line 17 def raw_data FasterCSV.read(@file_handler.file_path, CsvMapper.) end |