Class: DJ::Worker
- Inherits:
-
Object
- Object
- DJ::Worker
- Includes:
- Delayed::Job::Extras
- Defined in:
- lib/delayed_job_extras/worker.rb,
lib/delayed_job_test_enhancements.rb
Direct Known Subclasses
Constant Summary
Constants included from Delayed::Job::Extras
Delayed::Job::Extras::PRIORITY_LEVELS
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Worker
constructor
A new instance of Worker.
- #method_missing(sym, *args, &block) ⇒ Object
Methods included from Delayed::Job::Extras
Constructor Details
#initialize(attributes = {}) ⇒ Worker
Returns a new instance of Worker.
7 8 9 10 11 |
# File 'lib/delayed_job_extras/worker.rb', line 7 def initialize(attributes = {}) self.attributes = attributes self.attributes = self.attributes.stringify_keys self.id = self.attributes['id'] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/delayed_job_extras/worker.rb', line 13 def method_missing(sym, *args, &block) attribute = sym.to_s case attribute when /(.+)\=$/ self.attributes[$1] = args.first when /(.+)\?$/ # self.attributes.has_key?($1.to_sym) return self.attributes[$1] else return self.attributes[attribute] end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/delayed_job_extras/worker.rb', line 5 def attributes @attributes end |
Class Method Details
.disable_re_enqueue ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/delayed_job_test_enhancements.rb', line 23 def disable_re_enqueue # puts "disabling enqueue_again" eval %{ class Delayed::Job def enqueue_again # puts "re enqueing has been disabled!" end end } end |