Class: ResqueDelayWithMongoid::DelayProxy
- Inherits:
- ActiveSupport::BasicObject
- Defined in:
- lib/resque_delay_with_mongoid/message_sending.rb
Class Method Summary collapse
-
.perform(args) ⇒ Object
Called asynchrously by Resque.
Instance Method Summary collapse
-
#initialize(target, options) ⇒ DelayProxy
constructor
A new instance of DelayProxy.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(target, options) ⇒ DelayProxy
Returns a new instance of DelayProxy.
5 6 7 8 |
# File 'lib/resque_delay_with_mongoid/message_sending.rb', line 5 def initialize(target, ) @target = target @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
10 11 12 13 14 |
# File 'lib/resque_delay_with_mongoid/message_sending.rb', line 10 def method_missing(method, *args) queue = @options[:to] || :default performable_method = PerformableMethod.create(@target, method, args) ::Resque::Job.create(queue, DelayProxy, performable_method.resque_args) end |
Class Method Details
.perform(args) ⇒ Object
Called asynchrously by Resque
17 18 19 |
# File 'lib/resque_delay_with_mongoid/message_sending.rb', line 17 def self.perform(args) PerformableMethod.new(*args).perform end |