Class: Spree::Imports::RowProcessors::Base

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree/imports/row_processors/base.rb

Direct Known Subclasses

Customer, ProductTranslation, ProductVariant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row, mappings: nil, schema_fields: nil) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
10
11
12
13
# File 'app/services/spree/imports/row_processors/base.rb', line 5

def initialize(row, mappings: nil, schema_fields: nil)
  @row = row
  @import = row.import
  @attributes = if mappings && schema_fields
                  build_schema_hash(row, mappings, schema_fields)
                else
                  row.to_schema_hash
                end
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



15
16
17
# File 'app/services/spree/imports/row_processors/base.rb', line 15

def attributes
  @attributes
end

#importObject (readonly)

Returns the value of attribute import.



15
16
17
# File 'app/services/spree/imports/row_processors/base.rb', line 15

def import
  @import
end

#rowObject (readonly)

Returns the value of attribute row.



15
16
17
# File 'app/services/spree/imports/row_processors/base.rb', line 15

def row
  @row
end

Instance Method Details

#process!Object

Raises:

  • (NotImplementedError)


17
18
19
# File 'app/services/spree/imports/row_processors/base.rb', line 17

def process!
  raise NotImplementedError, 'Subclasses must implement the process! method'
end