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.
20 21 22 23 24 25 |
# File 'lib/dry/validation/message.rb', line 20 def initialize(left, right, ) @left = left @right = right = @path = left.path end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
12 13 14 |
# File 'lib/dry/validation/message.rb', line 12 def left @left end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
18 19 20 |
# File 'lib/dry/validation/message.rb', line 18 def end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
16 17 18 |
# File 'lib/dry/validation/message.rb', line 16 def path @path end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
14 15 16 |
# File 'lib/dry/validation/message.rb', line 14 def right @right end |
Instance Method Details
#hint? ⇒ Boolean
27 28 29 |
# File 'lib/dry/validation/message.rb', line 27 def hint? false end |
#root? ⇒ Boolean
31 32 33 |
# File 'lib/dry/validation/message.rb', line 31 def root? path.empty? end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/dry/validation/message.rb', line 35 def to_s [left, right].uniq.join(" #{messages[:or]} ") end |