Class: Minion::Message
- Inherits:
-
Object
- Object
- Minion::Message
- Defined in:
- lib/mb-minion/message.rb
Instance Attribute Summary collapse
-
#batch ⇒ Object
Returns the value of attribute batch.
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
-
#content ⇒ Object
Returns the value of attribute content.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #<<(data) ⇒ Object
-
#callback ⇒ Object
Enqueue a job for the next callback in the chain.
-
#initialize(json = "{}", header = nil) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(json = "{}", header = nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 |
# File 'lib/mb-minion/message.rb', line 8 def initialize json="{}", header=nil data = decode(json) @headers = [header] @callbacks = data['callbacks'] @content = data['content'] @batch = data['batch'] || [] end |
Instance Attribute Details
#batch ⇒ Object
Returns the value of attribute batch.
5 6 7 |
# File 'lib/mb-minion/message.rb', line 5 def batch @batch end |
#callbacks ⇒ Object
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/mb-minion/message.rb', line 5 def callbacks @callbacks end |
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/mb-minion/message.rb', line 5 def content @content end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/mb-minion/message.rb', line 5 def headers @headers end |
Instance Method Details
#<<(data) ⇒ Object
16 17 18 |
# File 'lib/mb-minion/message.rb', line 16 def << data @content << data end |