class Hash

Public Instance Methods

deep_find(key, hash = self) click to toggle source
# File lib/gertrude/core_ext/hash.rb, line 10
def deep_find(key, hash = self)
  return hash[key] if hash.respond_to?(:key?) && hash.key?(key)
  return unless hash.is_a?(Enumerable)
  found = nil
  hash.find { |*x| found = deep_find(key, x.last) }
  found
end
has_deep_key?(key) click to toggle source
# File lib/gertrude/core_ext/hash.rb, line 2
def has_deep_key?(key)
  self.has_key?(key) || any? { |k, v| v.has_deep_key?(key) if v.is_a? Hash }
end
has_deep_value?(value) click to toggle source
# File lib/gertrude/core_ext/hash.rb, line 6
def has_deep_value?(value)
  self.has_value?(value) || any? { |k, v| v.has_deep_value?(value) if v.is_a? Hash }
end