Module: Decidim::AttributeObject

Defined in:
lib/decidim/attribute_object.rb,
lib/decidim/attribute_object/form.rb,
lib/decidim/attribute_object/model.rb,
lib/decidim/attribute_object/type_map.rb,
lib/decidim/attribute_object/type_resolver.rb,
lib/decidim/attribute_object/nested_validator.rb

Overview

This module provides functionality to create objects with attributes that are not attached to any database objects and have type coercions for the types of their objects. This is a similar concept as Virtus used to provide for the core objects, such as Forms and manifest classes. The programming API is backwards compatible with Virtus on most parts.

Defined Under Namespace

Modules: Model, TypeMap Classes: Form, NestedValidator, TypeResolver

Class Method Summary collapse

Class Method Details

.type(type) ⇒ Object



20
21
22
23
24
# File 'lib/decidim/attribute_object.rb', line 20

def self.type(type, **)
  typedef = types.resolve(type, **)

  ActiveModel::Type.lookup(typedef[:type], **typedef[:options])
end

.typesObject



16
17
18
# File 'lib/decidim/attribute_object.rb', line 16

def self.types
  @types ||= TypeResolver.new
end