Exception: Validate::Error::ConstraintViolationError
- Inherits:
-
StandardError
- Object
- StandardError
- StandardError
- Validate::Error::ConstraintViolationError
- Defined in:
- lib/validate/errors.rb
Instance Attribute Summary collapse
-
#violations ⇒ Object
readonly
Returns the value of attribute violations.
Instance Method Summary collapse
-
#initialize(violations) ⇒ ConstraintViolationError
constructor
A new instance of ConstraintViolationError.
- #message ⇒ Object
Constructor Details
#initialize(violations) ⇒ ConstraintViolationError
Returns a new instance of ConstraintViolationError.
27 28 29 30 |
# File 'lib/validate/errors.rb', line 27 def initialize(violations) @violations = violations super() end |
Instance Attribute Details
#violations ⇒ Object (readonly)
Returns the value of attribute violations.
25 26 27 |
# File 'lib/validate/errors.rb', line 25 def violations @violations end |
Instance Method Details
#message ⇒ Object
32 33 34 35 36 37 |
# File 'lib/validate/errors.rb', line 32 def @violations.group_by(&:path) .transform_values { |violations| violations.map(&:message) } .map { |path, | "#{path}: #{.join(', ')}" } .join("\n") end |