Class: Delayed::DelayProxy

Inherits:
ActiveSupport::ProxyObject
  • Object
show all
Defined in:
lib/delayed/message_sending.rb

Instance Method Summary collapse

Constructor Details

#initialize(payload_class, target, options) ⇒ DelayProxy

Returns a new instance of DelayProxy.



5
6
7
8
9
# File 'lib/delayed/message_sending.rb', line 5

def initialize(payload_class, target, options)
  @payload_class = payload_class
  @target = target
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **kwargs) ⇒ Object



11
12
13
# File 'lib/delayed/message_sending.rb', line 11

def method_missing(method, *args, **kwargs)
  Job.enqueue({ payload_object: @payload_class.new(@target, method.to_sym, args, kwargs) }.merge(@options))
end