Class: Messed::Util::RemoteStatus::StatusHandler

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/messed/util/remote_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/messed/util/remote_status.rb', line 9

def status
  @status
end

Instance Method Details

#post_initObject



11
12
13
14
# File 'lib/messed/util/remote_status.rb', line 11

def post_init
  puts "post..."
  send_data "status\r\n"
end

#receive_data(data) ⇒ Object



16
17
18
19
20
21
# File 'lib/messed/util/remote_status.rb', line 16

def receive_data(data)
  JSON.parse(data).each do |key, value|
    self.status[key] = status
  end
  EM.stop_event_loop
end