Module: SessionManagementMethods
- Included in:
- Inform::IO::Session
- Defined in:
- lib/runtime/session.rb
Overview
The SessionManagementMethods module
Constant Summary collapse
Instance Method Summary collapse
- #[](channel) ⇒ Object
- #[]=(channel, session) ⇒ Object
- #add_promiscuous_states(*states) ⇒ Object
- #get(channel) ⇒ Object
- #include?(channel) ⇒ Boolean
- #register(channel, session) ⇒ Object
- #sessions_by_channel ⇒ Object
- #unregister(channel) ⇒ Object
Instance Method Details
#[](channel) ⇒ Object
44 45 46 |
# File 'lib/runtime/session.rb', line 44 def [](channel) sessions_by_channel[channel] end |
#[]=(channel, session) ⇒ Object
48 49 50 |
# File 'lib/runtime/session.rb', line 48 def []=(channel, session) sessions_by_channel[channel] = session end |
#add_promiscuous_states(*states) ⇒ Object
28 29 30 |
# File 'lib/runtime/session.rb', line 28 def add_promiscuous_states(*states) Promiscuous.merge states.flatten end |
#get(channel) ⇒ Object
56 57 58 |
# File 'lib/runtime/session.rb', line 56 def get(channel) sessions_by_channel[channel] ||= Session.new(channel) end |
#include?(channel) ⇒ Boolean
52 53 54 |
# File 'lib/runtime/session.rb', line 52 def include?(channel) sessions_by_channel.include?(channel) end |
#register(channel, session) ⇒ Object
36 37 38 |
# File 'lib/runtime/session.rb', line 36 def register(channel, session) sessions_by_channel[channel] = session end |
#sessions_by_channel ⇒ Object
32 33 34 |
# File 'lib/runtime/session.rb', line 32 def sessions_by_channel SessionsByChannel end |
#unregister(channel) ⇒ Object
40 41 42 |
# File 'lib/runtime/session.rb', line 40 def unregister(channel) sessions_by_channel.delete(channel) end |