Class: Dry::Schema::Message::Or
- Inherits:
-
Object
- Object
- Dry::Schema::Message::Or
- Defined in:
- lib/dry/schema/message/or.rb,
lib/dry/schema/extensions/hints.rb
Overview
Hints extension for Or messages
Instance Attribute Summary collapse
- #left ⇒ Object readonly private
- #messages ⇒ Object readonly private
- #path ⇒ Object readonly private
- #right ⇒ Object readonly private
Instance Method Summary collapse
-
#dump ⇒ String
(also: #to_s)
Dump a message into a string.
- #hint? ⇒ Boolean private
-
#initialize(left, right, messages) ⇒ Or
constructor
private
A new instance of Or.
- #to_a ⇒ Object private
Constructor Details
#initialize(left, right, messages) ⇒ Or
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.
Returns a new instance of Or.
28 29 30 31 32 33 |
# File 'lib/dry/schema/message/or.rb', line 28 def initialize(left, right, ) @left = left @right = right @messages = @path = left.path end |
Instance Attribute Details
#left ⇒ Object (readonly)
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.
16 17 18 |
# File 'lib/dry/schema/message/or.rb', line 16 def left @left end |
#messages ⇒ Object (readonly)
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.
25 26 27 |
# File 'lib/dry/schema/message/or.rb', line 25 def @messages end |
#path ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/dry/schema/message/or.rb', line 22 def path @path end |
#right ⇒ Object (readonly)
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.
19 20 21 |
# File 'lib/dry/schema/message/or.rb', line 19 def right @right end |
Instance Method Details
#dump ⇒ String Also known as: to_s
Dump a message into a string
42 43 44 |
# File 'lib/dry/schema/message/or.rb', line 42 def dump to_a.map(&:dump).join(" #{[:or][:text]} ") 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.
27 28 29 |
# File 'lib/dry/schema/extensions/hints.rb', line 27 def hint? false end |
#to_a ⇒ 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.
48 49 50 |
# File 'lib/dry/schema/message/or.rb', line 48 def to_a [left, right] end |