Class: EventflitClient::Channels
- Inherits:
-
Object
- Object
- EventflitClient::Channels
- Defined in:
- lib/eventflit-client/channels.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
Instance Method Summary collapse
- #add(channel_name, user_data = nil) ⇒ Object (also: #<<)
- #empty? ⇒ Boolean
- #find(channel_name) ⇒ Object (also: #[])
-
#initialize(logger = EventflitClient.logger) ⇒ Channels
constructor
A new instance of Channels.
- #remove(channel_name) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(logger = EventflitClient.logger) ⇒ Channels
Returns a new instance of Channels.
6 7 8 9 |
# File 'lib/eventflit-client/channels.rb', line 6 def initialize(logger=EventflitClient.logger) @logger = logger @channels = {} end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
4 5 6 |
# File 'lib/eventflit-client/channels.rb', line 4 def channels @channels end |
Instance Method Details
#add(channel_name, user_data = nil) ⇒ Object Also known as: <<
11 12 13 |
# File 'lib/eventflit-client/channels.rb', line 11 def add(channel_name, user_data=nil) @channels[channel_name] ||= Channel.new(channel_name, user_data, @logger) end |
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/eventflit-client/channels.rb', line 23 def empty? @channels.empty? end |
#find(channel_name) ⇒ Object Also known as: []
15 16 17 |
# File 'lib/eventflit-client/channels.rb', line 15 def find(channel_name) @channels[channel_name] end |
#remove(channel_name) ⇒ Object
19 20 21 |
# File 'lib/eventflit-client/channels.rb', line 19 def remove(channel_name) @channels.delete(channel_name) end |
#size ⇒ Object
27 28 29 |
# File 'lib/eventflit-client/channels.rb', line 27 def size @channels.size end |