class DbSchema::Definitions::Field::Custom

Public Class Methods

class_for(type_name) click to toggle source
# File lib/db_schema/definitions/field/custom.rb, line 6
def class_for(type_name)
  raise ArgumentError if type_name.nil?

  custom_types[type_name] ||= Class.new(self) do
    define_method :type do
      type_name
    end

    define_singleton_method :type do
      type_name
    end

    define_method :custom? do
      true
    end
  end
end

Private Class Methods

custom_types() click to toggle source
# File lib/db_schema/definitions/field/custom.rb, line 25
def custom_types
  @custom_types ||= {}
end