Class: CSVMagic::Importer
- Inherits:
-
Object
- Object
- CSVMagic::Importer
- Defined in:
- lib/csv_magic/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.
5 6 7 8 9 10 11 12 13 |
# File 'lib/csv_magic/importer.rb', line 5 def initialize(params, ) @file_handler = FileHandler.new() if @file_handler.save_temp_file(params[[:file_field]]) set_attributes_from_valid_file() else raise MissingFileContentsError end end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
3 4 5 |
# File 'lib/csv_magic/importer.rb', line 3 def filename @filename end |
#map_fields ⇒ Object (readonly)
Returns the value of attribute map_fields.
3 4 5 |
# File 'lib/csv_magic/importer.rb', line 3 def map_fields @map_fields end |
Instance Method Details
#raw_data ⇒ Object
15 16 17 |
# File 'lib/csv_magic/importer.rb', line 15 def raw_data CSV_HANDLER.read(@file_handler.file_path, CSVMagic.) end |