Sha256: 7c647ff35fc5611203de7b6744f3146a260e5538c79cd650c56b6248d62ec25d
Contents?: true
Size: 462 Bytes
Versions: 5
Compression:
Stored size: 462 Bytes
Contents
module Rbox module CollectNestedKey def collect_nested_key(obj, key) result = [] case obj when Hash if obj.key? key result << obj[key] else obj.each do |k, child| result += collect_nested_key(child, key) end end when Array obj.each do |child| result += collect_nested_key(child, key) end end result.flatten end end end
Version data entries
5 entries across 5 versions & 1 rubygems