global
def search_hash(search, hash)
-
the
(Hash
) -- hash to search -
the
(String
) -- search term
def search_hash(search, hash) matching = {} hash.each_pair do |key, value| next unless key.is_a?(String) if normalize(key) == normalize(search) return {key => value} elsif normalize(key).start_with?(normalize(search)) matching[key] = value end end matching end