Sha256: 3028a910eb19cbd5725f25c25117546701ccbdfcd275882a5ab5bd1efad7dd7b

Contents?: true

Size: 717 Bytes

Versions: 12

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/string/inflections'
require 'rails_admin/config/fields'
require 'rails_admin/config/fields/association'

module RailsAdmin
  module Config
    module Fields
      module Types
        @@registry = {}

        def self.load(type)
          @@registry.fetch(type.to_sym) { raise "Unsupported field datatype: #{type}" }
        end

        def self.register(type, klass = nil)
          if klass.nil? && type.is_a?(Class)
            klass = type
            type = klass.name.to_s.demodulize.underscore
          end
          @@registry[type.to_sym] = klass
        end

        require 'rails_admin/config/fields/types/all'
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rails_admin-3.2.1 lib/rails_admin/config/fields/types.rb
rails_admin-3.2.0 lib/rails_admin/config/fields/types.rb
rails_admin-3.2.0.rc lib/rails_admin/config/fields/types.rb
rails_admin-3.2.0.beta lib/rails_admin/config/fields/types.rb
rails_admin-3.1.4 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.3 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.2 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.1 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.0 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.0.rc2 lib/rails_admin/config/fields/types.rb
rails_admin-3.1.0.rc lib/rails_admin/config/fields/types.rb
rails_admin-3.1.0.beta lib/rails_admin/config/fields/types.rb