Class: Pechkin::Message
- Inherits:
-
Object
- Object
- Pechkin::Message
- Defined in:
- lib/pechkin/message.rb
Overview
Message object
TBD
Instance Method Summary collapse
-
#initialize(message) ⇒ Message
constructor
A new instance of Message.
- #prepare(data) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(message) ⇒ Message
Returns a new instance of Message.
6 7 8 |
# File 'lib/pechkin/message.rb', line 6 def initialize() @message = end |
Instance Method Details
#prepare(data) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/pechkin/message.rb', line 10 def prepare(data) data = (@message['variables'] || {}).merge(data) # Find message and try substitute values to message parameters. = render(data, substitute(data, @message)) text = '' text = .delete('template') if .key?('template') [, text] end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/pechkin/message.rb', line 20 def to_h Marshal.load(Marshal.dump(@message)) end |