Class: PusherClient::Channels
- Inherits:
-
Object
- Object
- PusherClient::Channels
- Defined in:
- lib/pusher-client/channels.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
Instance Method Summary collapse
- #add(channel_name) ⇒ Object (also: #<<)
- #empty? ⇒ Boolean
- #find(channel_name) ⇒ Object (also: #[])
-
#initialize ⇒ Channels
constructor
A new instance of Channels.
- #remove(channel_name) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ Channels
Returns a new instance of Channels.
5 6 7 |
# File 'lib/pusher-client/channels.rb', line 5 def initialize @channels = {} end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
3 4 5 |
# File 'lib/pusher-client/channels.rb', line 3 def channels @channels end |
Instance Method Details
#add(channel_name) ⇒ Object Also known as: <<
9 10 11 12 13 14 |
# File 'lib/pusher-client/channels.rb', line 9 def add(channel_name) unless @channels[channel_name] @channels[channel_name] = Channel.new(channel_name) end @channels[channel_name] end |
#empty? ⇒ Boolean
25 26 27 |
# File 'lib/pusher-client/channels.rb', line 25 def empty? @channels.empty? end |
#find(channel_name) ⇒ Object Also known as: []
16 17 18 |
# File 'lib/pusher-client/channels.rb', line 16 def find(channel_name) @channels[channel_name] end |
#remove(channel_name) ⇒ Object
20 21 22 23 |
# File 'lib/pusher-client/channels.rb', line 20 def remove(channel_name) @channels.delete(channel_name) @channels end |
#size ⇒ Object
29 30 31 |
# File 'lib/pusher-client/channels.rb', line 29 def size @channels.size end |