Class: MotionWiretap::WiretapProc
- Inherits:
-
WiretapTarget
- Object
- Wiretap
- WiretapTarget
- MotionWiretap::WiretapProc
- Defined in:
- lib/motion-wiretap/all/wiretap.rb
Instance Attribute Summary
Attributes inherited from WiretapTarget
Instance Method Summary collapse
-
#initialize(target, queue, and_then) ⇒ WiretapProc
constructor
A new instance of WiretapProc.
- #start ⇒ Object
Methods inherited from Wiretap
#and_then, #cancel!, #combine, #dealloc, #enqueue, #filter, #listen, #map, #on_error, #queue, #reduce, #teardown, #trigger_changed, #trigger_changed_on, #trigger_completed, #trigger_completed_on, #trigger_error, #trigger_error_on
Constructor Details
#initialize(target, queue, and_then) ⇒ WiretapProc
Returns a new instance of WiretapProc.
400 401 402 403 404 405 406 407 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 400 def initialize(target, queue, and_then) @started = false super(target) and_then(&and_then) if and_then queue(queue) if queue start if and_then end |
Instance Method Details
#start ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/motion-wiretap/all/wiretap.rb', line 409 def start unless @started @started = true enqueue do begin if @target.arity == 0 @target.call else @target.call(-> (value) { self.trigger_changed(value) }) end rescue Exception => error trigger_error(error) else trigger_completed end end end end |