Class: Backgrounded::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/backgrounded/proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delegate, options = {}) ⇒ Proxy

Returns a new instance of Proxy.



4
5
6
7
# File 'lib/backgrounded/proxy.rb', line 4

def initialize(delegate, options={})
  @delegate = delegate
  @options = options || {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



9
10
11
12
13
# File 'lib/backgrounded/proxy.rb', line 9

def method_missing(method_name, *args)
  Backgrounded.logger.debug("Requesting #{Backgrounded.handler} backgrounded method: #{method_name} for instance #{delegate} with options: #{options}")
  Backgrounded.handler.request(delegate, method_name, args, options)
  nil
end

Instance Attribute Details

#delegateObject (readonly)

Returns the value of attribute delegate.



3
4
5
# File 'lib/backgrounded/proxy.rb', line 3

def delegate
  @delegate
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/backgrounded/proxy.rb', line 3

def options
  @options
end