Class: RhetButler::SlideMessageQueue
- Inherits:
-
Object
- Object
- RhetButler::SlideMessageQueue
- Includes:
- Thin::Logging
- Defined in:
- lib/rhet-butler/messaging.rb
Instance Attribute Summary collapse
-
#current_slide ⇒ Object
Returns the value of attribute current_slide.
Instance Method Summary collapse
- #enqueue(message) ⇒ Object
-
#initialize ⇒ SlideMessageQueue
constructor
A new instance of SlideMessageQueue.
- #inspect ⇒ Object
- #subscribe(session) ⇒ Object
- #unsubscribe(session) ⇒ Object
Constructor Details
#initialize ⇒ SlideMessageQueue
Returns a new instance of SlideMessageQueue.
47 48 49 |
# File 'lib/rhet-butler/messaging.rb', line 47 def initialize @listeners = {} end |
Instance Attribute Details
#current_slide ⇒ Object
Returns the value of attribute current_slide.
46 47 48 |
# File 'lib/rhet-butler/messaging.rb', line 46 def @current_slide end |
Instance Method Details
#enqueue(message) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rhet-butler/messaging.rb', line 64 def enqueue() @listeners.keys.each do |session| begin session.send() rescue MetaState::WrongStateError => wse log_info("Follower in wrong state: #{wse.inspect}") @listeners.delete(session) end end end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/rhet-butler/messaging.rb', line 51 def inspect "<<#{self.class.name} Listeners: #{@listeners.keys.length}>>" end |
#subscribe(session) ⇒ Object
55 56 57 58 |
# File 'lib/rhet-butler/messaging.rb', line 55 def subscribe(session) @listeners[session] = true session.send() unless .nil? end |
#unsubscribe(session) ⇒ Object
60 61 62 |
# File 'lib/rhet-butler/messaging.rb', line 60 def unsubscribe(session) @listeners.delete(session) end |