Class: Rdb::EventManager
- Inherits:
-
Object
- Object
- Rdb::EventManager
- Defined in:
- lib/rdb/web/server.rb
Instance Attribute Summary collapse
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
Instance Method Summary collapse
- #broadcast(attrs) ⇒ Object
-
#initialize ⇒ EventManager
constructor
A new instance of EventManager.
Constructor Details
#initialize ⇒ EventManager
Returns a new instance of EventManager.
10 11 12 |
# File 'lib/rdb/web/server.rb', line 10 def initialize @clients = [] end |
Instance Attribute Details
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
21 22 23 |
# File 'lib/rdb/web/server.rb', line 21 def clients @clients end |
Instance Method Details
#broadcast(attrs) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/rdb/web/server.rb', line 14 def broadcast(attrs) data = JSON.dump(attrs) for client in @clients client.push(:data => data) end end |