Sha256: 34ed808ebe72fe73e341de6c12ea5b07fbca3b3ccf5f7b0fd06189b0546a1487

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module EventflitClient
  class Channels

    attr_reader :channels

    def initialize(logger=EventflitClient.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

1 entries across 1 versions & 1 rubygems

Version Path
eventflit-client-0.1.0 lib/eventflit-client/channels.rb