Sha256: 89ade73b03b020c57296916470460fa0a6adc8cf7a259fd18dd1e1cdd11fd781

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

module Configurations
  # Configuration is a blank object in order to allow configuration
  # of various properties including keywords
  #
  class Data
    def initialize(
      data,
      reserved_method_validator = Validators::ReservedMethods.new
    )
      @data = data
      @reserved_method_validator = reserved_method_validator
    end

    def [](key)
      @data[key]
    end

    def []=(key, value)
      @reserved_method_validator.validate!(key)

      @data[key] = value
    end

    def key?(key)
      @data.key?(key)
    end

    def fetch(key, &block)
      @data.fetch(key, &block)
    end

    def each(&block)
      @data.each(&block)
    end

    def reduce(acc, &block)
      @data.reduce(acc, &block)
    end

    def inspect
      @data.inspect
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
configurations-2.2.2 lib/configurations/data.rb
configurations-2.2.1 lib/configurations/data.rb