Class: Rfid::ClientMessage
- Inherits:
-
Object
- Object
- Rfid::ClientMessage
- Defined in:
- lib/rfid/client_message.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
Instance Method Summary collapse
-
#initialize(body) ⇒ ClientMessage
constructor
A new instance of ClientMessage.
- #perform ⇒ Object
Constructor Details
#initialize(body) ⇒ ClientMessage
Returns a new instance of ClientMessage.
7 8 9 10 11 |
# File 'lib/rfid/client_message.rb', line 7 def initialize(body) @hash = parse(body) @event_name = @hash['event'] || 'default' @data = @hash['data'] || {} end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/rfid/client_message.rb', line 5 def data @data end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
5 6 7 |
# File 'lib/rfid/client_message.rb', line 5 def event_name @event_name end |
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rfid/client_message.rb', line 13 def perform case @event_name when 'system' then run @data['command'] else return false end end |