Method: Hash#flatten_keys_to_array
- Defined in:
- lib/patches/core_ext/hash/flatten_keys.rb
#flatten_keys_to_array ⇒ Object Also known as: flatten_keys
Returns a flat hash where all nested keys are collapsed into an array of keys.
hash = { person: { name: { first: 'Rob' }, age: '28' } }
hash.flatten_keys_to_array
=> {[:person, :name, :first] => "Rob", [:person, :age]=>"28" }
| 11 12 13 | # File 'lib/patches/core_ext/hash/flatten_keys.rb', line 11 def flatten_keys_to_array _flatten_keys(self) end |