Class: Expressive::ExtendedValue
- Inherits:
-
Object
- Object
- Expressive::ExtendedValue
- Defined in:
- lib/extended_value.rb
Instance Attribute Summary collapse
-
#adder ⇒ Object
Returns the value of attribute adder.
-
#setter ⇒ Object
Returns the value of attribute setter.
Instance Method Summary collapse
- #<<(value) ⇒ Object
-
#initialize(property_name, scope) ⇒ ExtendedValue
constructor
A new instance of ExtendedValue.
- #set(value) ⇒ Object
Constructor Details
#initialize(property_name, scope) ⇒ ExtendedValue
Returns a new instance of ExtendedValue.
5 6 7 8 9 10 |
# File 'lib/extended_value.rb', line 5 def initialize(property_name, scope) @scope = scope @property_name = property_name.to_s @scope[@property_name] = self end |
Instance Attribute Details
#adder ⇒ Object
Returns the value of attribute adder.
4 5 6 |
# File 'lib/extended_value.rb', line 4 def adder @adder end |
#setter ⇒ Object
Returns the value of attribute setter.
4 5 6 |
# File 'lib/extended_value.rb', line 4 def setter @setter end |
Instance Method Details
#<<(value) ⇒ Object
16 17 18 |
# File 'lib/extended_value.rb', line 16 def <<(value) adder.call value, @scope end |
#set(value) ⇒ Object
12 13 14 |
# File 'lib/extended_value.rb', line 12 def set(value) setter.call value, @scope end |