class Marten::Schema::Field::Array

Overview

Represents an array schema field.

Defined in:

marten/schema/field.cr
marten/schema/field/array.cr

Constructors

Instance Method Summary

Instance methods inherited from class Marten::Schema::Field::Base

deserialize(value) deserialize, empty_value?(value) : ::Bool empty_value?, get_raw_data(data) get_raw_data, id : String id, required? : Bool required?, serialize(value) : ::Array(::String) | Nil | ::String serialize, validate(schema, value) validate

Constructor methods inherited from class Marten::Schema::Field::Base

new(id : ::String, required : ::Bool = true) new

Macros inherited from module Marten::Template::CanDefineTemplateAttributes

template_attributes(*names) template_attributes

Constructor Detail

def self.new(id : ::String, of_field : Base, required : ::Bool = true) #

[View source]

Instance Method Detail

def deserialize(value) : ::Array(Field::Any) | Nil #
Description copied from class Marten::Schema::Field::Base

Deserializes a raw field value to the corresponding field value.


[View source]
def empty_value?(value) : ::Bool #
Description copied from class Marten::Schema::Field::Base

Returns true if the value is considered empty by the field.


[View source]
def get_raw_data(data) #
Description copied from class Marten::Schema::Field::Base

Returns the raw data of the field.


[View source]
def serialize(value) : ::Array(::String) | Nil | ::String #
Description copied from class Marten::Schema::Field::Base

Serializes a field value.


[View source]
def validate(schema, value) #
Description copied from class Marten::Schema::Field::Base

Runs custom validation logic for a specific schema field and schema object.

This method should be overriden for each field implementation that requires custom validation logic.


[View source]