Skip to content

alias Athena::Validator::Constraints::Callback::CallbackProc #

Convenience alias to make creating AVD::Constraints::Callback procs easier.

# Create a proc to handle the validation
callback = do |value, context, payload|
  return if (value = value.get(Int32)).even?

  context.add_violation "This value should be even."

# Instantiate a callback constraint with this proc
constraint = callback: callback

Alias definition

Athena::Validator::Constraints::Callback::ValueContainer, Athena::Validator::ExecutionContextInterface, Hash(String, String)? -> Nil