Class: FieldMapper::Custom::Value
- Inherits:
-
Standard::Value
- Object
- Standard::Value
- FieldMapper::Custom::Value
- Defined in:
- lib/field_mapper/custom/value.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#standard_value ⇒ Object
readonly
Returns the value of attribute standard_value.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, field: nil, priority: nil, standard_value: nil) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(value, field: nil, priority: nil, standard_value: nil) ⇒ Value
Returns a new instance of Value.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/field_mapper/custom/value.rb', line 13 def initialize( value, field: nil, priority: nil, standard_value: nil ) super value, field: field if !standard_value.nil? if field.standard_field.nil? = "[#{field.name}] [#{value}] is mapped to a standard but [#{field.name}] is not" raise StandardFieldNotFound.new() end raw_standard_value = standard_value standard_value = field.standard_field.find_value(standard_value) if standard_value.nil? = "[#{field.name}] [#{value}] is mapped, but the standard [#{field.standard_field.name}] doesn't define the value [#{raw_standard_value}]" raise StandardValueNotFound.new() end end @priority = priority @standard_value = standard_value end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'lib/field_mapper/custom/value.rb', line 6 def field @field end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
6 7 8 |
# File 'lib/field_mapper/custom/value.rb', line 6 def priority @priority end |
#standard_value ⇒ Object (readonly)
Returns the value of attribute standard_value.
6 7 8 |
# File 'lib/field_mapper/custom/value.rb', line 6 def standard_value @standard_value end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/field_mapper/custom/value.rb', line 6 def value @value end |