Class: Pocolog::Upgrade::Ops::CompoundCast
- Defined in:
- lib/pocolog/upgrade/ops/compound_cast.rb
Overview
Casts a field in a compound
Instance Attribute Summary collapse
-
#field_convertions ⇒ Object
readonly
Returns the value of attribute field_convertions.
Attributes inherited from Base
Instance Method Summary collapse
- #call(target, value) ⇒ Object
-
#initialize(field_convertions, to_type) ⇒ CompoundCast
constructor
A new instance of CompoundCast.
Methods inherited from Base
Constructor Details
#initialize(field_convertions, to_type) ⇒ CompoundCast
Returns a new instance of CompoundCast.
8 9 10 11 |
# File 'lib/pocolog/upgrade/ops/compound_cast.rb', line 8 def initialize(field_convertions, to_type) @field_convertions = field_convertions super(to_type) end |
Instance Attribute Details
#field_convertions ⇒ Object (readonly)
Returns the value of attribute field_convertions.
6 7 8 |
# File 'lib/pocolog/upgrade/ops/compound_cast.rb', line 6 def field_convertions @field_convertions end |
Instance Method Details
#call(target, value) ⇒ Object
13 14 15 16 17 |
# File 'lib/pocolog/upgrade/ops/compound_cast.rb', line 13 def call(target, value) field_convertions.each do |field_name, field_ops| field_ops.call(target.raw_get(field_name), value.raw_get(field_name)) end end |