Class: Sidekiq::Extensions::CustomProxy

Inherits:
BasicObject
Defined in:
lib/sidekiq/extensions/custom_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(performable, target, options = {}) ⇒ CustomProxy

Returns a new instance of CustomProxy.



4
5
6
7
8
# File 'lib/sidekiq/extensions/custom_proxy.rb', line 4

def initialize(performable, target, options = {})
  @performable = performable
  @target = target
  @opts = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



10
11
12
13
# File 'lib/sidekiq/extensions/custom_proxy.rb', line 10

def method_missing(name, *args)
  obj = [@target.to_global_id.to_s, name, *args]
  @performable.client_push({"class" => @performable, "args" => [obj.to_json]}.merge(@opts))
end