Class: Dry::Schema::Message::Or::MultiPath
- Defined in:
- lib/dry/schema/message/or/multi_path.rb,
lib/dry/schema/extensions/hints.rb
Overview
A message type used by OR operations with different paths
Defined Under Namespace
Classes: MessageArray
Instance Attribute Summary
Attributes inherited from Abstract
Class Method Summary collapse
- .handler(message) ⇒ Object private
Instance Method Summary collapse
- #_paths ⇒ Object private
- #hint? ⇒ Boolean private
- #messages ⇒ Object private
- #path ⇒ Object private
- #root ⇒ Object private
- #to_h ⇒ Object
- #to_or(root) ⇒ Object private
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from Dry::Schema::Message::Or::Abstract
Class Method Details
.handler(message) ⇒ 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.
38 39 40 |
# File 'lib/dry/schema/message/or/multi_path.rb', line 38 def self.handler() handlers.find { |k,| .is_a?(k) }&.last end |
Instance Method Details
#_paths ⇒ 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.
71 72 73 |
# File 'lib/dry/schema/message/or/multi_path.rb', line 71 def _paths @paths ||= [Path[root]] end |
#hint? ⇒ Boolean
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.
35 36 37 |
# File 'lib/dry/schema/extensions/hints.rb', line 35 def hint? false end |
#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.
56 57 58 |
# File 'lib/dry/schema/message/or/multi_path.rb', line 56 def @messages ||= .flat_map { _1.to_or(root) } end |
#path ⇒ 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.
66 67 68 |
# File 'lib/dry/schema/message/or/multi_path.rb', line 66 def path root end |
#root ⇒ 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.
61 62 63 |
# File 'lib/dry/schema/message/or/multi_path.rb', line 61 def root @root ||= .flat_map(&:_paths).reduce(:&) end |