Sha256: 9a31dd8d0d016c65e60dd9df7910046207342aa168444b7e5846e3d3d0aa49c9

Contents?: true

Size: 1.37 KB

Versions: 21

Compression:

Stored size: 1.37 KB

Contents

require "active_model/type/helpers"
require "active_model/type/value"

require "active_model/type/big_integer"
require "active_model/type/binary"
require "active_model/type/boolean"
require "active_model/type/date"
require "active_model/type/date_time"
require "active_model/type/decimal"
require "active_model/type/float"
require "active_model/type/immutable_string"
require "active_model/type/integer"
require "active_model/type/string"
require "active_model/type/time"

require "active_model/type/registry"

module ActiveModel
  module Type
    @registry = Registry.new

    class << self
      attr_accessor :registry # :nodoc:

      # Add a new type to the registry, allowing it to be get through ActiveModel::Type#lookup
      def register(type_name, klass = nil, **options, &block)
        registry.register(type_name, klass, **options, &block)
      end

      def lookup(*args, **kwargs) # :nodoc:
        registry.lookup(*args, **kwargs)
      end
    end

    register(:big_integer, Type::BigInteger)
    register(:binary, Type::Binary)
    register(:boolean, Type::Boolean)
    register(:date, Type::Date)
    register(:datetime, Type::DateTime)
    register(:decimal, Type::Decimal)
    register(:float, Type::Float)
    register(:immutable_string, Type::ImmutableString)
    register(:integer, Type::Integer)
    register(:string, Type::String)
    register(:time, Type::Time)
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
activemodel-5.1.7 lib/active_model/type.rb
activemodel-5.1.7.rc1 lib/active_model/type.rb
activemodel-5.1.6.2 lib/active_model/type.rb
activemodel-5.1.6.1 lib/active_model/type.rb
activemodel-5.1.6 lib/active_model/type.rb
tdiary-5.0.8 vendor/bundle/gems/activemodel-5.1.5/lib/active_model/type.rb
activemodel-5.1.5 lib/active_model/type.rb
activemodel-5.1.5.rc1 lib/active_model/type.rb
activemodel-5.1.4 lib/active_model/type.rb
activemodel-5.1.4.rc1 lib/active_model/type.rb
activemodel-5.1.3 lib/active_model/type.rb
activemodel-5.1.3.rc3 lib/active_model/type.rb
activemodel-5.1.3.rc2 lib/active_model/type.rb
activemodel-5.1.3.rc1 lib/active_model/type.rb
tdiary-5.0.5 vendor/bundle/gems/activemodel-5.1.2/lib/active_model/type.rb
activemodel-5.1.2 lib/active_model/type.rb
activemodel-5.1.2.rc1 lib/active_model/type.rb
activemodel-5.1.1 lib/active_model/type.rb
activemodel-5.1.0 lib/active_model/type.rb
activemodel-5.1.0.rc2 lib/active_model/type.rb