Class: MotionWiretap::WiretapReducer
- Inherits:
-
WiretapChild
- Object
- Wiretap
- WiretapChild
- MotionWiretap::WiretapReducer
- Defined in:
- lib/motion-wiretap/all/wiretap.rb
Instance Attribute Summary
Attributes inherited from Wiretap
Instance Method Summary collapse
-
#initialize(parent, memo, reducer) ⇒ WiretapReducer
constructor
A new instance of WiretapReducer.
-
#trigger_changed(*values) ⇒ Object
passes each value through the @reducer, passing in the return value of the previous call (starting with @memo).
Methods inherited from WiretapChild
Methods inherited from Wiretap
#and_then, #cancel!, #combine, #dealloc, #enqueue, #filter, #listen, #map, #on_error, #queue, #reduce, #teardown, #trigger_changed_on, #trigger_completed, #trigger_completed_on, #trigger_error, #trigger_error_on
Constructor Details
#initialize(parent, memo, reducer) ⇒ WiretapReducer
Returns a new instance of WiretapReducer.
385 386 387 388 389 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 385 def initialize(parent, memo, reducer) @reducer = reducer @memo = memo super(parent) end |
Instance Method Details
#trigger_changed(*values) ⇒ Object
passes each value through the @reducer, passing in the return value of the previous call (starting with @memo)
393 394 395 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 393 def trigger_changed(*values) Wiretap.instance_method(:trigger_changed).bind(self).call(values.inject(@memo, &@reducer)) end |