Sha256: 2068fe34982c1b0e7ba67cfc0f08d800a182fc5f0ccd9b1b9e270dfc8dbd88a9

Contents?: true

Size: 330 Bytes

Versions: 1

Compression:

Stored size: 330 Bytes

Contents

# frozen_string_literal: true

module ActiveResource
  class InheritingHash < Hash
    def initialize(parent_hash = {})
      # Default hash value must be nil, which allows fallback lookup on parent hash
      super(nil)
      @parent_hash = parent_hash
    end

    def [](key)
      super || @parent_hash[key]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeresource-6.0.0 lib/active_resource/inheriting_hash.rb