Skip to content

module Athena::Validator::Violation::ConstraintViolationBuilderInterface #

A Builder Pattern type for building AVD::Violation::ConstraintViolationInterfaces.

Allows using the methods defined on self to construct the desired violation before adding it to the context.

Direct including types

Athena::Validator::Violation::ConstraintViolationBuilder

Methods#

abstract #add : Nil#

Adds the violation to the current AVD::ExecutionContextInterface.

View source

abstract #add_parameter(key : String, value : _) : AVD::Violation::ConstraintViolationBuilderInterface#

Adds a parameter with the provided key and value to the violations' AVD::Violation::ConstraintViolationInterface#parameters. The provided value is stringified via #to_s before being added to the parameters.

Returns self for chaining.

View source

abstract #cause(cause : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface#

Sets the AVD::Violation::ConstraintViolationInterface#cause

Returns self for chaining.

View source

abstract #code(code : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface#

Sets the AVD::Violation::ConstraintViolationInterface#code

Returns self for chaining.

View source

abstract #set_parameters(parameters : Hash(String, String)) : AVD::Violation::ConstraintViolationBuilderInterface#

Overrides the entire AVD::Violation::ConstraintViolationInterface#parameters hash with the provided parameters.

Returns self for chaining.

View source