Sha256: b5e8e84ae3d1baa294a399b97e64a7db09f798170b1df2f7ced3307d0629a96d

Contents?: true

Size: 984 Bytes

Versions: 19

Compression:

Stored size: 984 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, **options)
      typedef = types.resolve(type, **options)

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-core-0.28.4 lib/decidim/attribute_object.rb
decidim-core-0.27.9 lib/decidim/attribute_object.rb
decidim-core-0.28.3 lib/decidim/attribute_object.rb
decidim-core-0.27.8 lib/decidim/attribute_object.rb
decidim-core-0.28.2 lib/decidim/attribute_object.rb
decidim-core-0.27.7 lib/decidim/attribute_object.rb
decidim-core-0.28.1 lib/decidim/attribute_object.rb
decidim-core-0.27.6 lib/decidim/attribute_object.rb
decidim-core-0.28.0 lib/decidim/attribute_object.rb
decidim-core-0.27.5 lib/decidim/attribute_object.rb
decidim-core-0.28.0.rc5 lib/decidim/attribute_object.rb
decidim-core-0.28.0.rc4 lib/decidim/attribute_object.rb
decidim-core-0.27.4 lib/decidim/attribute_object.rb
decidim-core-0.27.3 lib/decidim/attribute_object.rb
decidim-core-0.27.2 lib/decidim/attribute_object.rb
decidim-core-0.27.1 lib/decidim/attribute_object.rb
decidim-core-0.27.0 lib/decidim/attribute_object.rb
decidim-core-0.27.0.rc2 lib/decidim/attribute_object.rb
decidim-core-0.27.0.rc1 lib/decidim/attribute_object.rb