struct Athena::Validator::Violation::ConstraintViolation
inherits Struct
#
Basic implementation of AVD::Violation::ConstraintViolationInterface.
Included modules
Athena::Validator::Violation::ConstraintViolationInterface
Constructors#
.new(message : String, message_template : String | Nil, parameters : Hash(String, String), root : _, property_path : String, invalid_value_container : AVD::Container, plural : Int32 | Nil = nil, code : String | Nil = nil, constraint : AVD::Constraint | Nil = nil, cause : String | Nil = nil)#
Methods#
#==(other : AVD::Violation::ConstraintViolationInterface) : Bool#
Returns true if other is the same as self, otherwise false.
#code : String | ::Nil#
Returns a unique machine readable error code representing self.
All constraints of a specific "type" should have the same code.
#constraint : AVD::Constraint#
Returns the AVD::Constraint whose validation caused the violation, if any.
#inspect(io : IO) : Nil#
Appends this struct's name and instance variables names and values to the given IO.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p1.to_s # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
#message_template : String | ::Nil#
Returns the raw violation message.
The message template contains placeholders for the parameters returned via #parameters.
#parameters : Hash(String, String)#
Returns the parameters used to render the #message_template.
#plural : Int32 | ::Nil#
Returns a number used to pluralize the violation message.
The returned value is used to determine the right plurlaization form.