Class: Dry::Validation::Message::Or
- Inherits:
-
Object
- Object
- Dry::Validation::Message::Or
- Defined in:
- lib/dry/validation/message.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #hint? ⇒ Boolean
-
#initialize(left, right, messages) ⇒ Or
constructor
A new instance of Or.
- #root? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(left, right, messages) ⇒ Or
Returns a new instance of Or.
19 20 21 22 23 24 |
# File 'lib/dry/validation/message.rb', line 19 def initialize(left, right, ) @left = left @right = right @messages = @path = left.path end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
11 12 13 |
# File 'lib/dry/validation/message.rb', line 11 def left @left end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
17 18 19 |
# File 'lib/dry/validation/message.rb', line 17 def @messages end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
15 16 17 |
# File 'lib/dry/validation/message.rb', line 15 def path @path end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
13 14 15 |
# File 'lib/dry/validation/message.rb', line 13 def right @right end |
Instance Method Details
#hint? ⇒ Boolean
26 27 28 |
# File 'lib/dry/validation/message.rb', line 26 def hint? false end |
#root? ⇒ Boolean
30 31 32 |
# File 'lib/dry/validation/message.rb', line 30 def root? path.empty? end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/dry/validation/message.rb', line 34 def to_s [left, right].uniq.join(" #{[:or]} ") end |