struct

Altair::Record::Model::Rule

Inherits Struct < Value < Object

One declared validation rule.

Constructors

new(kind : Symbol, attribute : Symbol | Nil = nil, method : Symbol | Nil = nil, minimum : Int32 | Nil = nil, maximum : Int32 | Nil = nil, greater_than : Float64 | Nil = nil, integer : Bool | Nil = nil, scope : Symbol | Nil = nil, message : String | Nil = nil, possibilities : Array(String) | Range(Int32, Int32) | Nil = nil, format : Regex | Nil = nil)
Source

Instance methods

attribute

The attribute the rule checks (nil for custom-method rules).

Source
format

The pattern a :format rule must match.

Source
greater_than

The greater_than option of a :numericality rule.

Source
integer

The integer option of a :numericality rule.

Source
kind

The rule kind: :presence, :length, :numericality, :uniqueness or :custom.

Source
maximum

The maximum option of a :length rule.

Source
message

A custom message replacing the default one.

Source
method

The method a :custom rule runs.

Source
minimum

The minimum option of a :length rule.

Source
possibilities

The allowed values (Array or Range) of an :inclusion / :exclusion rule.

Source
scope

The scope option of a :uniqueness rule.

Source