Class: Warren::Message::Full
- Inherits:
-
Object
- Object
- Warren::Message::Full
- Defined in:
- lib/warren/message/full.rb
Overview
Generates a payload of an active_record object
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#headers ⇒ {}
For compatibility.
-
#initialize(record) ⇒ Full
constructor
A new instance of Full.
-
#payload ⇒ String
The payload of the message.
-
#routing_key ⇒ String
The routing key that will be used for the message, not including the routing_key_prefix configured in warren.yml.
Constructor Details
#initialize(record) ⇒ Full
Returns a new instance of Full.
9 10 11 |
# File 'lib/warren/message/full.rb', line 9 def initialize(record) @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'lib/warren/message/full.rb', line 7 def record @record end |
Instance Method Details
#headers ⇒ {}
For compatibility. Returns an empty hash.
41 42 43 |
# File 'lib/warren/message/full.rb', line 41 def headers {} end |
#payload ⇒ String
The payload of the message.
33 34 35 |
# File 'lib/warren/message/full.rb', line 33 def payload MultiJson.dump(record) end |
#routing_key ⇒ String
The routing key that will be used for the message, not including the routing_key_prefix configured in warren.yml. If #record responds to ‘routing_key` will use that instead
20 21 22 23 24 25 26 |
# File 'lib/warren/message/full.rb', line 20 def routing_key if record.respond_to?(:routing_key) record.routing_key else "saved.#{record.class.name.underscore}.#{record.id}" end end |