annotation Check::Checker
Overview
Declare a method as a checker.
# Triggered by the instance.
@[Check::Checker]
def custom_checker(v : Check::Validation, required : Bool, format : Bool)
puts "custom checker triggered on instance"
end
# Triggered statically.
@[Check::Checker]
def self.custom_checker(v : Check::Validation, h, cleaned_h, required : Bool, format : Bool)
puts "custom checker triggered statically"
cleaned_h
end
When .check
and #check
are called, the custom checkers are triggered respectively.