Class: ActiveRecordImporter::DataProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_importer/data_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(import, row_attrs) ⇒ DataProcessor

Returns a new instance of DataProcessor.



9
10
11
12
13
# File 'lib/active_record_importer/data_processor.rb', line 9

def initialize(import, row_attrs)
  @import = import
  @importable = import.resource.safe_constantize
  @row_attrs = row_attrs
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def attributes
  @attributes
end

#find_attributesObject (readonly)

Returns the value of attribute find_attributes.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def find_attributes
  @find_attributes
end

#importObject (readonly)

Returns the value of attribute import.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def import
  @import
end

#importableObject (readonly)

Returns the value of attribute importable.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def importable
  @importable
end

#instanceObject (readonly)

Returns the value of attribute instance.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def instance
  @instance
end

#row_attrsObject (readonly)

Returns the value of attribute row_attrs.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def row_attrs
  @row_attrs
end

#row_errorsObject (readonly)

Returns the value of attribute row_errors.



3
4
5
# File 'lib/active_record_importer/data_processor.rb', line 3

def row_errors
  @row_errors
end

Instance Method Details

#processObject



15
16
17
18
19
# File 'lib/active_record_importer/data_processor.rb', line 15

def process
  fetch_instance_attributes
  fetch_find_attributes
  create_instance
end