Sha256: 79f2b321a1308d630b9a41d07a6a44260f6ca293d98c76872e6d59d6a29068af

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

require 'ostruct'

module A9n
  class Struct < OpenStruct
    def empty?
      @table.empty?
    end

    def keys
      @table.keys
    end

    def fetch(name, default = nil)
      @table.fetch(name.to_sym, default)
    end

    def key?(key)
      to_h.key?(key)
    end

    def merge(key_value)
      key_value.each_pair do |key, value|
        self[key] = value
      end
    end

    def method_missing(name, *args)
      raise NoSuchConfigurationVariable.new(name)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
a9n-0.4.0 lib/a9n/struct.rb