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.
-
#delivery_info ⇒ Object
readonly
Returns the value of attribute delivery_info.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
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.
11 12 13 14 15 16 |
# File 'lib/hutch/message.rb', line 11 def initialize(delivery_info, properties, payload) @delivery_info = delivery_info @properties = properties @payload = payload @body = MultiJson.load(payload).with_indifferent_access end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
22 23 24 |
# File 'lib/hutch/message.rb', line 22 def body @body end |
#delivery_info ⇒ Object (readonly)
Returns the value of attribute delivery_info.
9 10 11 |
# File 'lib/hutch/message.rb', line 9 def delivery_info @delivery_info end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
9 10 11 |
# File 'lib/hutch/message.rb', line 9 def payload @payload end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
9 10 11 |
# File 'lib/hutch/message.rb', line 9 def properties @properties end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
24 25 26 27 28 |
# File 'lib/hutch/message.rb', line 24 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 |