class Avram::Attribute(T)
- Avram::Attribute(T)
- Reference
- Object
Direct Known Subclasses
Defined in:
avram/attribute.crConstructors
Macro Summary
Instance Method Summary
- #[](key)
- #[]?(key)
- #add_error(message : String = "is invalid")
- #add_error(message : Proc | Avram::CallableErrorMessage)
-
#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.
-
#allow_blank? : Bool
This can be used as an escape hatch when you may have a blank string that's allowed to be saved.
- #changed?(from : T | Nil | Nothing = IGNORE, to : T | Nil | Nothing = IGNORE) : Bool
- #errors : Array(String)
- #extract(params : Avram::Paramable)
- #name : Symbol
- #original_value : T | Nil
- #param : Avram::Uploadable | Array(String) | String
- #param_key : String
- #permitted
- #reset_errors
- #to_f
- #to_f64
- #to_i
- #to_i32
- #to_i64
-
#to_s(time_format : String)
NOTE to_s(io : IO) is used when passing an object in to string interpolation.
-
#to_s
These methods may accidentally get called on attributes inside of operations.
- #valid? : Bool
- #value : T | Nil
- #value=(value : T | Nil)
Instance methods inherited from class Object
blank_for_validates_required? : Bool
blank_for_validates_required?
Constructor Detail
Macro Detail
Instance Method Detail
This can be used as an escape hatch when you may have a blank string that's allowed to be saved.
This can be used as an escape hatch when you may have a blank string that's allowed to be saved.
NOTE to_s(io : IO) is used when passing an object in to string interpolation. Don't override that method.
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