Class: WresqueWrapper::WrapperProxies::Proxy
- Inherits:
-
Object
- Object
- WresqueWrapper::WrapperProxies::Proxy
- Defined in:
- lib/wresque_wrapper.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target, klass, target_id, queue) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args) ⇒ Object
- #respond_to?(method) ⇒ Boolean
Constructor Details
#initialize(target, klass, target_id, queue) ⇒ Proxy
Returns a new instance of Proxy.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wresque_wrapper.rb', line 42 def initialize(target,klass,target_id,queue) queue ||= klass.default_queue unless queue raise RuntimeError, "No queue specified, and target class has no default queue", caller end @target = target @klass = klass @target_id = target_id @klass.queue = queue end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/wresque_wrapper.rb', line 53 def method_missing(method,*args) if @target.respond_to?(method) Resque.enqueue(@target,@target_id,method,*args) else @target.send(method,*args) end end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
40 41 42 |
# File 'lib/wresque_wrapper.rb', line 40 def target @target end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
61 62 63 |
# File 'lib/wresque_wrapper.rb', line 61 def respond_to?(method) super || @target.respond_to?(method) end |