class Kemal::FormValidator::NumberRange

Overview

Kemal::FormValidator::NumberRange validates that a number is of a minimum and/or maximum value, inclusive.

Adding this validator to a field will also add the #min and/or #max attribute to the field.

Defined in:

kemal-form/validators.cr

Constructors

Instance Method Summary

Instance methods inherited from class Kemal::FormValidator::Validator

validate(field : Kemal::Form::Field) validate

Constructor Detail

def self.new(min : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 | Nil = nil, max : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 | Nil = nil, message = "") #

[View source]

Instance Method Detail

def max : Number::Primitive | Nil #

Returns the maximum value of the number.


[View source]
def min : Number::Primitive | Nil #

Returns the minimum value of the number.


[View source]
def validate(field : Kemal::Form::Field) #

[View source]