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, serializer) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(delivery_info, properties, payload, serializer) ⇒ Message
Returns a new instance of Message.
9 10 11 12 13 14 |
# File 'lib/hutch/message.rb', line 9 def initialize(delivery_info, properties, payload, serializer) @delivery_info = delivery_info @properties = properties @payload = payload @body = serializer.decode(payload) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
20 21 22 |
# File 'lib/hutch/message.rb', line 20 def body @body end |
#delivery_info ⇒ Object (readonly)
Returns the value of attribute delivery_info.
7 8 9 |
# File 'lib/hutch/message.rb', line 7 def delivery_info @delivery_info end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
7 8 9 |
# File 'lib/hutch/message.rb', line 7 def payload @payload end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
7 8 9 |
# File 'lib/hutch/message.rb', line 7 def properties @properties end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
22 23 24 25 26 |
# File 'lib/hutch/message.rb', line 22 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 |