lib/dazeus/dazeus.rb in dazeus-0.0.1.201306161750 vs lib/dazeus/dazeus.rb in dazeus-0.0.1.201306161801
- old
+ new
@@ -191,20 +191,26 @@
end
@subscribers['COMMAND'][command].push [network, callback]
success
end
- def run
+ def once
+ handle_event conn.receive
+ end
+ def run
loop do
break if conn.closed?
- handle_event conn.receive
+ once
end
end
+ alias_method :start, :run
- def stop
+ def close
conn.close
end
+ alias_method :stop, :close
+
private
def send_receive(message)
conn.send message
response = nil