Sha256: 669ba671abc57cba87c63cf8c12601b5bb8bc2da0966d24cb9d6f6ea18eb84f6

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module PusherClient
  class Channels
    attr_reader :channels

    def initialize
      @channels = {}
    end

    def add(channel_name)
      unless @channels[channel_name]
        @channels[channel_name] = Channel.new(channel_name)
      end
      @channels[channel_name]
    end

    def find(channel_name)
      @channels[channel_name]
    end

    def remove(channel_name)
      @channels.delete(channel_name)
      @channels
    end

    def empty?
      @channels.empty?
    end

    def size
      @channels.size
    end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pusher-client-nc-0.2.1 lib/pusher-client/channels.rb