Class: Csvbuilder::Import::Attribute

Inherits:
AttributeBase
  • Object
show all
Defined in:
lib/csvbuilder/importer/internal/import/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column_name, source_value, attribute_errors, row_model) ⇒ Attribute

Returns a new instance of Attribute.



10
11
12
13
14
15
# File 'lib/csvbuilder/importer/internal/import/attribute.rb', line 10

def initialize(column_name, source_value, attribute_errors, row_model)
  @source_value     = source_value
  @attribute_errors = attribute_errors || []

  super(column_name, row_model)
end

Instance Attribute Details

#attribute_errorsObject (readonly)

Returns the value of attribute attribute_errors.



8
9
10
# File 'lib/csvbuilder/importer/internal/import/attribute.rb', line 8

def attribute_errors
  @attribute_errors
end

#source_valueObject (readonly)

Returns the value of attribute source_value.



8
9
10
# File 'lib/csvbuilder/importer/internal/import/attribute.rb', line 8

def source_value
  @source_value
end

Instance Method Details

#parsed_valueObject



25
26
27
# File 'lib/csvbuilder/importer/internal/import/attribute.rb', line 25

def parsed_value
  @parsed_value ||= formatted_value
end

#valueObject



17
18
19
20
21
22
23
# File 'lib/csvbuilder/importer/internal/import/attribute.rb', line 17

def value
  @value ||= if attribute_errors.present?
               nil
             else
               formatted_value
             end
end