Module: Delayed::DelayPush

Defined in:
lib/action_pusher/delayed.rb

Instance Method Summary collapse

Instance Method Details

#delay(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/action_pusher/delayed.rb', line 9

def delay(options = {})
  proxy = DelayProxy.new(PerformablePusher, self, options)

  # Redefine method_missing on DelayProxy to instantiate our pusher properly
  def proxy.method_missing(method, *args)
    pusher = @target.send(method.to_sym, *args)
    Job.enqueue({:payload_object => @payload_class.new(pusher, :deliver, nil)}.merge(@options))
  end

  proxy
end