Sha256: b4968ca1df2d284800cbc34fd5f2ce2a5cf3bddd890e9f7ce4e89f42874aff61

Contents?: true

Size: 265 Bytes

Versions: 6

Compression:

Stored size: 265 Bytes

Contents

unless Hash.new.respond_to? :dig
  class Hash
    def dig first_key, *other_keys
      val = self[first_key]
      if other_keys.empty?
        val
      elsif val and val.kind_of? Hash
        val.dig *other_keys
      else
        nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nutkins-0.12.0 lib/hash_dig.rb
nutkins-0.11.0 lib/hash_dig.rb
nutkins-0.10.3 lib/hash_dig.rb
nutkins-0.10.2 lib/hash_dig.rb
nutkins-0.10.1 lib/hash_dig.rb
nutkins-0.10.0 lib/hash_dig.rb