Sha256: 3ce6eda773568c1bdf7f72b6d55f09dfae21246a185f6d9168b9ef0164cf729e

Contents?: true

Size: 278 Bytes

Versions: 1

Compression:

Stored size: 278 Bytes

Contents

module Func
  module Hash
    # Deep fetch values out of a hash.
    #
    #   hash_fetch(target, :a, :b, :c)
    #   target.fetch(:a).fetch(:b).fetch(:c)
    #
    def hash_fetch(target, *keys)
      keys.each {|key| target = target.fetch(key) }
      target
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
func-0.1.0 lib/func/hash.rb