Class: Warren::Message
- Inherits:
-
Object
- Object
- Warren::Message
- Defined in:
- lib/warren/message.rb
Overview
rubocop:todo Style/Documentation
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record) ⇒ Message
constructor
A new instance of Message.
- #payload ⇒ Object
- #routing_key ⇒ Object
Constructor Details
#initialize(record) ⇒ Message
Returns a new instance of Message.
4 5 6 |
# File 'lib/warren/message.rb', line 4 def initialize(record) @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record
2 3 4 |
# File 'lib/warren/message.rb', line 2 def record @record end |
Instance Method Details
#payload ⇒ Object
16 17 18 |
# File 'lib/warren/message.rb', line 16 def payload MultiJson.dump(record) end |
#routing_key ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/warren/message.rb', line 8 def routing_key if record.respond_to?(:routing_key) record.routing_key else "#{Rails.env}.saved.#{record.class.name.underscore}.#{record.id}" end end |