class

Avram::Attribute(T)

Inherits Reference < Object

Constructors

new(name : Symbol, value : T | Nil, param_key : String, param : Array(String) | Avram::Uploadable | String | Nil = nil)
Source

Instance methods

[](key)
Source
[]?(key)
Source
add_error(message : String = "is invalid")
Source
allow_blank=(allow_blank : Bool)

This can be used as an escape hatch when you may have a blank string that's allowed to be saved.

Source
allow_blank?

This can be used as an escape hatch when you may have a blank string that's allowed to be saved.

Source
changed?(from : T | Nil | Nothing = IGNORE, to : T | Nil | Nothing = IGNORE) : Bool
Source
errors
Source
extract(params : Avram::Paramable)
Source
name
Source
original_value
Source
param
Source
param_key
Source
permitted
Source
reset_errors
Source
to_f
Source
to_f64
Source
to_i
Source
to_i32
Source
to_i64
Source
to_s(time_format : String)

NOTE: to_s(io : IO) is used when passing an object in to string interpolation. Don't override that method.

Source
to_s

These methods may accidentally get called on attributes inside of operations. Since these methods don't exist, chances are, you meant to call them on the value.

username.to_s
# VS
username.value.to_s
Source
valid?
Source
value
Source
value=(value : T | Nil)
Source

Macros

call_value_instead_error_message(method)
Source

Nested types