class PusherClient::Subscriptions

Attributes

subscriptions[R]

Public Class Methods

new() click to toggle source
# File lib/pusher-client/subscriptions.rb, line 5
def initialize
  @subscriptions = []
end

Public Instance Methods

<<(channel_name, user_data)
Alias for: add
[](channel_name)
Alias for: find_for_bind
add(channel_name, user_data) click to toggle source
# File lib/pusher-client/subscriptions.rb, line 9
def add(channel_name, user_data)
  unless find(channel_name, user_data)
    @subscriptions << Subscription.new(channel_name, user_data)
  end
  find(channel_name, user_data)
end
Also aliased as: <<
empty?() click to toggle source
# File lib/pusher-client/subscriptions.rb, line 34
def empty?
  @subscriptions.empty?
end
find(channel_name, user_data) click to toggle source
# File lib/pusher-client/subscriptions.rb, line 24
def find(channel_name, user_data)
  @subscriptions.detect { |s| s.channel == channel_name && s.user_data == user_data }
end
find_all(channel_name) click to toggle source
# File lib/pusher-client/subscriptions.rb, line 16
def find_all(channel_name)
  @subscriptions.select {|s| s.channel == channel_name }
end
find_for_bind(channel_name) click to toggle source
# File lib/pusher-client/subscriptions.rb, line 20
def find_for_bind(channel_name)
  @subscriptions.detect {|s| s.channel == channel_name }
end
Also aliased as: []
remove(channel_name, user_data) click to toggle source
# File lib/pusher-client/subscriptions.rb, line 28
def remove(channel_name, user_data)
  subscription = find(channel_name, user_data)
  @subscriptions.delete(subscription)
  @subscriptions
end
size() click to toggle source
# File lib/pusher-client/subscriptions.rb, line 38
def size
  @subscriptions.size
end