Class: JobDispatch::Client::Proxy
- Inherits:
-
Object
- Object
- JobDispatch::Client::Proxy
- Defined in:
- lib/job_dispatch/client/proxy.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(client, target, options = {}) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args) ⇒ Object
- #queue ⇒ Object
Constructor Details
#initialize(client, target, options = {}) ⇒ Proxy
Returns a new instance of Proxy.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/job_dispatch/client/proxy.rb', line 12 def initialize(client, target, ={}) @client = client @target = case target when Class target.to_s when String target else raise NotImplementedError, "Don't yet know how to serialize an object instance as a target" end = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
25 26 27 |
# File 'lib/job_dispatch/client/proxy.rb', line 25 def method_missing(method, *args) @client.enqueue(queue: queue, target: @target, method: method.to_s, parameters: args) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/job_dispatch/client/proxy.rb', line 10 def end |
Instance Method Details
#queue ⇒ Object
29 30 31 |
# File 'lib/job_dispatch/client/proxy.rb', line 29 def queue [:queue] || :default end |