Method: Dry::Schema::Path.keys_from_hash

Defined in:
lib/dry/schema/path.rb

.keys_from_hash(hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extract a list of keys from a hash



50
51
52
53
54
# File 'lib/dry/schema/path.rb', line 50

def self.keys_from_hash(hash)
  hash.inject([]) { |a, (k, v)|
    v.is_a?(::Hash) ? a.push(k, *keys_from_hash(v)) : a.push(k, v)
  }
end