Sha256: 1f81686d0aaeb2691ccb3dd95742999b6d81115170e2677e59ccd96b97d9987f

Contents?: true

Size: 970 Bytes

Versions: 6

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # 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.
  module AttributeObject
    autoload :Form, "decidim/attribute_object/form"
    autoload :Model, "decidim/attribute_object/model"
    autoload :NestedValidator, "decidim/attribute_object/nested_validator"
    autoload :TypeMap, "decidim/attribute_object/type_map"
    autoload :TypeResolver, "decidim/attribute_object/type_resolver"

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.29.1 lib/decidim/attribute_object.rb
decidim-core-0.29.0 lib/decidim/attribute_object.rb
decidim-core-0.29.0.rc4 lib/decidim/attribute_object.rb
decidim-core-0.29.0.rc3 lib/decidim/attribute_object.rb
decidim-core-0.29.0.rc2 lib/decidim/attribute_object.rb
decidim-core-0.29.0.rc1 lib/decidim/attribute_object.rb