Method: Dry::Schema::Path.call
- Defined in:
- lib/dry/schema/path.rb
.call(spec) ⇒ Path
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.
Coerce a spec into a path object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dry/schema/path.rb', line 27 def self.call(spec) case spec when ::Symbol, ::Array new([*spec]) when ::String new(spec.split(DOT).map(&:to_sym)) when ::Hash new(keys_from_hash(spec)) when self spec else raise ::ArgumentError, "+spec+ must be either a Symbol, Array, Hash or a #{name}" end end |