Class: Hutch::Message
- Inherits:
-
Object
- Object
- Hutch::Message
- Extended by:
- Forwardable
- Defined in:
- lib/hutch/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
-
#initialize(delivery_info, properties, payload) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(delivery_info, properties, payload) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 |
# File 'lib/hutch/message.rb', line 8 def initialize(delivery_info, properties, payload) @delivery_info = delivery_info @properties = properties @payload = payload @body = MultiJson.load(payload, symbolize_keys: true) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
19 20 21 |
# File 'lib/hutch/message.rb', line 19 def body @body end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
21 22 23 24 25 |
# File 'lib/hutch/message.rb', line 21 def to_s attrs = { :@body => body.to_s, message_id: , timestamp: , routing_key: routing_key } "#<Message #{attrs.map { |k,v| "#{k}=#{v.inspect}" }.join(', ')}>" end |