Module: Resque::Plugins::Methodize
- Defined in:
- lib/resque/plugins/methodize.rb
Instance Method Summary collapse
-
#method_missing(m, *args) ⇒ Object
Dynamic API for enqueuing jobs.
-
#perform(method, *args) ⇒ Object
Generic perform that calls to the specified method.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
Dynamic API for enqueuing jobs
11 12 13 14 15 16 17 18 |
# File 'lib/resque/plugins/methodize.rb', line 11 def method_missing(m, *args) super unless m.to_s =~ /^enqueue_/ # Enqueue the specified method method = m.to_s.sub(/^enqueue_/, '') queue = self.instance_variable_get(:@queue) || (self.respond_to?(:queue) and self.queue) Resque::Job.create(queue, self, method, *args) end |
Instance Method Details
#perform(method, *args) ⇒ Object
Generic perform that calls to the specified method
6 7 8 |
# File 'lib/resque/plugins/methodize.rb', line 6 def perform(method, *args) self.new.send(method.to_sym, *args) end |