Attribute
Represents an attribute defined on a representation.
Attributes map to model columns and define serialization behavior. Used by adapters to build contracts and serialize records.
Example
attribute = InvoiceRepresentation.attributes[:title]
attribute.name # => :title
attribute.type # => :string
attribute.filterable? # => trueInstance Methods
#deprecated?
#deprecated?
Whether this attribute is deprecated.
Returns
Boolean
#description
#description
The description for this attribute.
Returns
String, nil
#enum
#enum
The enum for this attribute.
Returns
Array<Object>, nil
#example
#example
The example for this attribute.
Returns
Object, nil
#filterable?
#filterable?
Whether this attribute is filterable.
Returns
Boolean
#format
#format
The format for this attribute.
Returns
Symbol, nil
#max
#max
The maximum for this attribute.
Returns
Integer, nil
#min
#min
The minimum for this attribute.
Returns
Integer, nil
#name
#name
The name for this attribute.
Returns
Symbol
#nullable?
#nullable?
Whether this attribute is nullable.
Returns
Boolean
#of
#of
The of for this attribute.
Returns
Symbol, nil
#optional?
#optional?
Whether this attribute is optional.
Returns
Boolean
#preload
#preload
The preload for this attribute.
Returns
Symbol, Array, Hash, nil
#sortable?
#sortable?
Whether this attribute is sortable.
Returns
Boolean
#writable?
#writable?
Whether this attribute is writable.
Returns
Boolean
See also
#writable_for?
#writable_for?(action)
Whether this attribute is writable for the given action.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
action | Symbol<:create, :update> | The action. |
Returns
Boolean
See also