Module: Gemmy::Patches::HashPatch::InstanceMethods::RecursiveKeys
- Defined in:
- lib/gemmy/patches/hash_patch.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#recursive_keys ⇒ Object
returns an array of arrays.
Class Method Details
.recursive_keys(hash) ⇒ Object
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/gemmy/patches/hash_patch.rb', line 94 def self.recursive_keys hash toplevel_keys = hash.keys.map &Array.method(:wrap) toplevel_keys.map do |key_array| if hash[key].is_a? Hash key_array.concat recursive_keys hash[key] else key_array end end end |