Method: Dry::Schema::Path#to_h

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

#to_h(value = EMPTY_ARRAY.dup) ⇒ 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.



62
63
64
65
66
# File 'lib/dry/schema/path.rb', line 62

def to_h(value = EMPTY_ARRAY.dup)
  value = [value] unless value.is_a?(::Array)

  keys.reverse_each.reduce(value) { |result, key| {key => result} }
end