Class: MotionBindable::Strategies::Proc
Constant Summary
collapse
- WATCH_TICK =
0.2
Instance Attribute Summary
#attr_name, #bound, #object
Instance Method Summary
collapse
#bind, find_by_reference, #initialize, register_strategy
Instance Method Details
#bound_value ⇒ Object
5
6
7
|
# File 'lib/strategies/proc.rb', line 5
def bound_value
bound.call
end
|
#object_value ⇒ Object
9
10
11
|
# File 'lib/strategies/proc.rb', line 9
def object_value
attribute
end
|
#on_bound_change(new = nil) ⇒ Object
13
14
15
|
# File 'lib/strategies/proc.rb', line 13
def on_bound_change(new = nil)
self.attribute = new || bound.call
end
|
#start_observing ⇒ Object
22
23
24
25
|
# File 'lib/strategies/proc.rb', line 22
def start_observing
@watching = true
watch
end
|
#unbind ⇒ Object
17
18
19
20
|
# File 'lib/strategies/proc.rb', line 17
def unbind
@watching = false
super
end
|