class MotionWiretap::WiretapProc

Public Class Methods

new(target, queue, and_then) click to toggle source
Calls superclass method MotionWiretap::WiretapTarget::new
# File lib/motion-wiretap/all/wiretap.rb, line 416
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

Public Instance Methods

start() click to toggle source
# File lib/motion-wiretap/all/wiretap.rb, line 425
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