Sha256: b25addcf69a7eb2f064968e6ec82a54d1dbe45cf1b7fc8ef6a93cf4d0c175935
Contents?: true
Size: 334 Bytes
Versions: 65
Compression:
Stored size: 334 Bytes
Contents
# Add a "dig" method to Hash to check if deeply nested elements exist # From: http://stackoverflow.com/questions/1820451/ruby-style-how-to-check-whether-a-nested-hash-element-exists class Hash def dig(*path) path.inject(self) do |location, key| location.respond_to?(:keys) ? location[key] : nil end end end
Version data entries
65 entries across 65 versions & 1 rubygems