Sha256: 8c8a5ab40fdc749daaf921e4be1bfdc46f595d39e96ce903a7636dc0c07f9730

Contents?: true

Size: 346 Bytes

Versions: 15

Compression:

Stored size: 346 Bytes

Contents

class Container
  class KeyNotFoundError < ::KeyError
    attr_reader :key

    def initialize(key)
      @key = key
      super
    end
  end

  def initialize
    @data = {}
  end

  def resolve(key)
    @data.fetch(key)
  rescue ::KeyError
    raise KeyNotFoundError.new(key)
  end

  def register(key, value)
    @data[key] = value
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/container.rb
3llo-1.3.1.pre.rc.0 lib/container.rb
3llo-1.2.0 lib/container.rb
3llo-1.1.0 lib/container.rb
3llo-1.0.0 lib/container.rb
3llo-1.0.0.pre.rc.0 lib/container.rb
3llo-0.3.1 lib/container.rb
3llo-0.3.0 lib/container.rb
3llo-0.2.0 lib/container.rb
3llo-0.1.12 lib/container.rb
3llo-0.1.11 lib/container.rb
3llo-0.1.10 lib/container.rb
3llo-0.1.9 lib/container.rb
3llo-0.1.9.beta lib/container.rb
3llo-0.1.8 lib/container.rb