Class: Backgrounder::Placer
- Inherits:
-
Object
- Object
- Backgrounder::Placer
- Defined in:
- lib/backgrounder/placer.rb
Instance Method Summary collapse
-
#initialize(obj, method_name, opts = {}) ⇒ Placer
constructor
A new instance of Placer.
- #place ⇒ Object
Constructor Details
#initialize(obj, method_name, opts = {}) ⇒ Placer
Returns a new instance of Placer.
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/backgrounder/placer.rb', line 2 def initialize(obj, method_name, opts = {}) if obj.class == Class @klass = obj @obj_id = opts[:args] && opts[:args][:init_args] ? 'new' : nil else @klass = obj.class @obj_id = fetch_id obj end @method_name = method_name @queue = opts[:queue] ? opts[:queue] : fetch_queue_name @args = opts[:args] ? opts[:args] : nil end |
Instance Method Details
#place ⇒ Object
15 16 17 |
# File 'lib/backgrounder/placer.rb', line 15 def place Resque::Job.create @queue, @klass, @obj_id, @method_name, @args end |