Class: Queued::QueueingProxy
- Inherits:
-
Object
- Object
- Queued::QueueingProxy
- Defined in:
- lib/queued/queueing_proxy.rb
Instance Attribute Summary collapse
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target, queue_name = nil) ⇒ QueueingProxy
constructor
A new instance of QueueingProxy.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(target, queue_name = nil) ⇒ QueueingProxy
Returns a new instance of QueueingProxy.
8 9 10 11 |
# File 'lib/queued/queueing_proxy.rb', line 8 def initialize(target, queue_name = nil) @target = target @queue_name = (queue_name || @target.class.name.tableize).to_sym end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/queued/queueing_proxy.rb', line 13 def method_missing(method, *args) unless target.respond_to?(method) raise NoMethodError.new \ "`#{method}' can't be invoked on #{target.class.name}", method, *args end Resque::Job.create(queue_name, target.class, target.id, method.to_sym, *args) nil end |
Instance Attribute Details
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
6 7 8 |
# File 'lib/queued/queueing_proxy.rb', line 6 def queue_name @queue_name end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/queued/queueing_proxy.rb', line 6 def target @target end |