Class: FieldMapper::Standard::Value
- Inherits:
-
Object
- Object
- FieldMapper::Standard::Value
- Defined in:
- lib/field_mapper/standard/value.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, field: nil) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(value, field: nil) ⇒ Value
Returns a new instance of Value.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/field_mapper/standard/value.rb', line 11 def initialize( value, field: nil ) raise ArgumentError.new("field is required") if field.nil? @field = field @value = field.cast(value, as_single_value: true) end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'lib/field_mapper/standard/value.rb', line 6 def field @field end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/field_mapper/standard/value.rb', line 6 def value @value end |