Module: ResqueAnyMethod::ClassMethods
- Defined in:
- lib/resque_any_method.rb
Instance Method Summary collapse
- #inherited(subclass) ⇒ Object
- #perform(id, method, *args) ⇒ Object
- #resque(method, *args) ⇒ Object
- #resque_queue(queue = 'low') ⇒ Object
Instance Method Details
#inherited(subclass) ⇒ Object
16 17 18 19 |
# File 'lib/resque_any_method.rb', line 16 def inherited(subclass) super subclass.instance_variable_set("@queue", @queue) end |
#perform(id, method, *args) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/resque_any_method.rb', line 21 def perform(id, method, *args) if id.nil? self.send(method, *args) else find(id).send(method, *args) end end |
#resque(method, *args) ⇒ Object
29 30 31 32 |
# File 'lib/resque_any_method.rb', line 29 def resque(method, *args) return self.send(method, *args) if Resque.inline? Resque.enqueue(self, nil, method, *args) end |
#resque_queue(queue = 'low') ⇒ Object
10 11 12 13 14 |
# File 'lib/resque_any_method.rb', line 10 def resque_queue(queue='low') class_eval %( @queue = :#{queue} ) end |