Class: ActionSet::Instructions::EntryValue
- Inherits:
-
Object
- Object
- ActionSet::Instructions::EntryValue
- Defined in:
- lib/action_set/instructions/entry_value.rb
Defined Under Namespace
Classes: ActiveModelAdapter, BooleanAdapter, PlainRubyAdapter, TimeWithZoneAdapter
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #cast(to:) ⇒ Object
-
#initialize(value) ⇒ EntryValue
constructor
A new instance of EntryValue.
Constructor Details
#initialize(value) ⇒ EntryValue
Returns a new instance of EntryValue.
8 9 10 |
# File 'lib/action_set/instructions/entry_value.rb', line 8 def initialize(value) @raw = value end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/action_set/instructions/entry_value.rb', line 6 def raw @raw end |
Instance Method Details
#cast(to:) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/action_set/instructions/entry_value.rb', line 12 def cast(to:) adapters.map do |adapter| value = adapter.new(@raw, to).process return value unless value.nil? end.compact.first || @raw end |