Class: Validate::Constraint::Violation
- Inherits:
-
Object
- Object
- Validate::Constraint::Violation
- Defined in:
- lib/validate/constraint.rb
Instance Attribute Summary collapse
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, path, constraint) ⇒ Violation
constructor
A new instance of Violation.
- #message(template = @constraint.message) ⇒ Object (also: #to_s)
Constructor Details
#initialize(value, path, constraint) ⇒ Violation
Returns a new instance of Violation.
9 10 11 12 13 |
# File 'lib/validate/constraint.rb', line 9 def initialize(value, path, constraint) @value = value @path = path @constraint = constraint end |
Instance Attribute Details
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
7 8 9 |
# File 'lib/validate/constraint.rb', line 7 def constraint @constraint end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/validate/constraint.rb', line 7 def path @path end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/validate/constraint.rb', line 7 def value @value end |
Instance Method Details
#message(template = @constraint.message) ⇒ Object Also known as: to_s
15 16 17 |
# File 'lib/validate/constraint.rb', line 15 def (template = @constraint.) (template % parameters).strip end |