Module: Decidim::AttributeObject

Defined in:
decidim-core/lib/decidim/attribute_object.rb,
decidim-core/lib/decidim/attribute_object/form.rb,
decidim-core/lib/decidim/attribute_object/model.rb,
decidim-core/lib/decidim/attribute_object/type_map.rb,
decidim-core/lib/decidim/attribute_object/type_resolver.rb,
decidim-core/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, **options) ⇒ Object



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

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

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

.typesObject



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

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