Class: Message::Worker::Enqueue::Enq
- Inherits:
-
Object
- Object
- Message::Worker::Enqueue::Enq
- Defined in:
- lib/message/worker.rb
Instance Method Summary collapse
-
#initialize(obj, job) ⇒ Enq
constructor
A new instance of Enq.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(obj, job) ⇒ Enq
Returns a new instance of Enq.
11 12 13 14 |
# File 'lib/message/worker.rb', line 11 def initialize(obj, job) @obj = obj @job = job end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/message/worker.rb', line 16 def method_missing(m, *args, &block) if block_given? raise ArgumentError, "Can't enqueue with block call." end unless @obj.respond_to?(m) raise NoMethodError, "undefined method `#{m}' for #{@obj.inspect}" end Message.worker(@job) << [@obj, m, args] end |