Class: PusherClient::Channels

Inherits:
Object
  • Object
show all
Defined in:
lib/pusher-client/channels.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChannels

Returns a new instance of Channels.



5
6
7
# File 'lib/pusher-client/channels.rb', line 5

def initialize
  @channels = {}
end

Instance Attribute Details

#channelsObject (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

Returns:

  • (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

#sizeObject



29
30
31
# File 'lib/pusher-client/channels.rb', line 29

def size
  @channels.size
end