Class: Bluecap::Message
- Inherits:
-
Object
- Object
- Bluecap::Message
- Defined in:
- lib/bluecap/message.rb
Instance Method Summary collapse
-
#contents ⇒ Object
The contents of the message.
-
#initialize(data) ⇒ Message
constructor
Initialize a Message with data.
-
#recipient ⇒ Object
The signature of the handler that should respond to the message.
Constructor Details
#initialize(data) ⇒ Message
Initialize a Message with data.
data - The String JSON message to parse.
7 8 9 |
# File 'lib/bluecap/message.rb', line 7 def initialize(data) @data = MultiJson.load(data, symbolize_keys: true) end |
Instance Method Details
#contents ⇒ Object
34 35 36 |
# File 'lib/bluecap/message.rb', line 34 def contents @data.first[1] end |
#recipient ⇒ Object
20 21 22 |
# File 'lib/bluecap/message.rb', line 20 def recipient @data.first[0].to_sym if @data.first end |