Module: Dry::Schema::Message::Or
- Defined in:
- lib/dry/schema/extensions/hints.rb,
lib/dry/schema/message/or.rb,
lib/dry/schema/message/or/abstract.rb,
lib/dry/schema/message/or/multi_path.rb,
lib/dry/schema/message/or/single_path.rb
Overview
Hints extension for Or messages
Defined Under Namespace
Classes: Abstract, MultiPath, SinglePath
Class Method Summary collapse
Class Method Details
.[](left, right, messages) ⇒ 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.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dry/schema/message/or.rb', line 11 def self.[](left, right, ) msgs = [left, right].flatten paths = msgs.map(&:path) if paths.uniq.size == 1 SinglePath.new(left, right, ) elsif MultiPath.handler(right) if MultiPath.handler(left) && paths.uniq.size > 1 MultiPath.new(left, right) else right end else msgs.max end end |