Sha256: 09aa23de3af396fff7a7f914ad58383eb50c7b68974dd997ab119a41fbab8a19

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

module Depth
  class ComplexHash
    include Depth::Actions
    include Depth::Enumeration::Enumerable
    DEFAULT_KEY_TRANSFORMER = proc { |obj, key| key }
    DEFAULT_NEXT_PROC = proc { |obj, key| obj[key] }
    DEFAULT_CREATION_PROC = proc { |obj, key, val| obj[key] = val }
    attr_reader :base, :next_proc, :creation_proc, :key_transformer
    alias_method :to_h, :base
    def initialize(base = {},
                   key_transformer: DEFAULT_KEY_TRANSFORMER,
                   next_proc: DEFAULT_NEXT_PROC,
                   creation_proc: DEFAULT_CREATION_PROC)
      @base = base
      @next_proc = next_proc
      @creation_proc = creation_proc
      @key_transformer = key_transformer
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
depth-0.4.3 lib/depth/complex_hash.rb
depth-0.4.2 lib/depth/complex_hash.rb
depth-0.4.1 lib/depth/complex_hash.rb
depth-0.4.0 lib/depth/complex_hash.rb