Class: Expressive::ExtendedValue

Inherits:
Object
  • Object
show all
Defined in:
lib/extended_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#adderObject

Returns the value of attribute adder.



4
5
6
# File 'lib/extended_value.rb', line 4

def adder
  @adder
end

#setterObject

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