Sha256: 207a6d2654be22c58930ea6f580295435977a4a50de885e5feba430cc905d048

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 Bytes

Contents

module PusherClient
  class Channels

    attr_reader :channels

    def initialize(logger=PusherClient.logger)
      @logger = logger
      @channels = {}
    end

    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)
    end

    def empty?
      @channels.empty?
    end

    def size
      @channels.size
    end

    alias :<< :add
    alias :[] :find

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pusher-client-0.6.2 lib/pusher-client/channels.rb
pusher-client-0.6.1 lib/pusher-client/channels.rb
pusher-client-0.6.0 lib/pusher-client/channels.rb
pusher-client-0.5.0 lib/pusher-client/channels.rb