Module: Loco::Emitter
- Included in:
- NotificationCenter
- Defined in:
- lib/loco/emitter.rb
Instance Method Summary collapse
- #add_hub(name, members = []) ⇒ Object
- #del_hub(name) ⇒ Object
- #emit(obj, event = nil, opts = {}) ⇒ Object
- #emit_to(recipient, data) ⇒ Object
- #get_hub(name) ⇒ Object
Instance Method Details
#add_hub(name, members = []) ⇒ Object
13 14 15 |
# File 'lib/loco/emitter.rb', line 13 def add_hub(name, members = []) Hub.new(name, members).save end |
#del_hub(name) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/loco/emitter.rb', line 21 def del_hub(name) hub = Hub.get name return false if hub.nil? hub.destroy end |
#emit(obj, event = nil, opts = {}) ⇒ Object
5 6 7 |
# File 'lib/loco/emitter.rb', line 5 def emit(obj, event = nil, opts = {}) Broadcaster.new(obj, event, opts).emit end |
#emit_to(recipient, data) ⇒ Object
9 10 11 |
# File 'lib/loco/emitter.rb', line 9 def emit_to(recipient, data) Sender.new(recipient, data).emit end |
#get_hub(name) ⇒ Object
17 18 19 |
# File 'lib/loco/emitter.rb', line 17 def get_hub(name) Hub.get name end |