lib/pusher-client/channels.rb in pusher-client-0.4.0 vs lib/pusher-client/channels.rb in pusher-client-0.5.0
- old
+ new
@@ -1,27 +1,24 @@
module PusherClient
class Channels
attr_reader :channels
- def initialize
+ def initialize(logger=PusherClient.logger)
+ @logger = logger
@channels = {}
end
- def add(channel_name)
- unless @channels[channel_name]
- @channels[channel_name] = Channel.new(channel_name)
- end
- @channels[channel_name]
+ def add(channel_name, user_data=nil)
+ @channels[channel_name] ||= Channel.new(channel_name, user_data, @logger)
end
def find(channel_name)
@channels[channel_name]
end
def remove(channel_name)
@channels.delete(channel_name)
- @channels
end
def empty?
@channels.empty?
end