Sha256: 5dd6dac1404c00a37f85513f69e6365a357c479b0893189c98b785dc1fd67ec1

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

require 'forwardable'

module Wisper
  class Configuration
    attr_reader :broadcasters

    def initialize
      @broadcasters = Broadcasters.new
    end

    def broadcaster(name, broadcaster)
      @broadcasters[name] = broadcaster
    end

    class Broadcasters
      extend Forwardable

      def_delegators :@data, :[], :[]=, :empty?, :include?, :clear

      def initialize
        @data = {}
      end

      def fetch(key)
        raise KeyError, "broadcaster not found for #{key}" unless include?(key)
        @data[key]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wisper-1.6.1 lib/wisper/configuration.rb