Sha256: c71e0d8cea70d645f7bb02cb95038180937a3d33dcd2fb7c2ca888b1d556504b

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'active_support'
require 'active_support/all'
require_relative 'declare_schema/version'

ActiveSupport::Dependencies.autoload_paths |= [__dir__]

module DeclareSchema
  class Boolean; end

  PLAIN_TYPES = {
    boolean:  Boolean,
    date:     Date,
    datetime: ActiveSupport::TimeWithZone,
    time:     Time,
    integer:  Integer,
    decimal:  BigDecimal,
    float:    Float,
    string:   String,
    text:     String
  }.freeze

  class << self
    def to_class(type)
      case type
      when Class
        type
      when Symbol, String
        PLAIN_TYPES[type.to_sym]
      else
        raise ArgumentError, "expected Class or Symbol or String: got #{type.inspect}"
      end
    end
  end
end

require 'declare_schema/extensions/active_record/fields_declaration'
require 'declare_schema/field_declaration_dsl'
require 'declare_schema/model'
require 'declare_schema/model/field_spec'
require 'declare_schema/model/index_definition'
require 'declare_schema/model/foreign_key_definition'
require 'declare_schema/model/table_options_definition'

require 'declare_schema/railtie' if defined?(Rails)

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
declare_schema-0.8.0 lib/declare_schema.rb
declare_schema-0.8.0.pre.6 lib/declare_schema.rb
declare_schema-0.8.0.pre.5 lib/declare_schema.rb
declare_schema-0.8.0.pre.4 lib/declare_schema.rb
declare_schema-0.8.0.pre.3 lib/declare_schema.rb
declare_schema-0.8.0.pre.2 lib/declare_schema.rb
declare_schema-0.8.0.pre.1 lib/declare_schema.rb
declare_schema-0.7.1 lib/declare_schema.rb
declare_schema-0.7.0 lib/declare_schema.rb
declare_schema-0.6.4 lib/declare_schema.rb
declare_schema-0.6.3 lib/declare_schema.rb
declare_schema-0.6.2 lib/declare_schema.rb
declare_schema-0.6.1 lib/declare_schema.rb
declare_schema-0.6.0 lib/declare_schema.rb
declare_schema-0.5.0 lib/declare_schema.rb
declare_schema-0.5.0.pre.3 lib/declare_schema.rb
declare_schema-0.5.0.pre.2 lib/declare_schema.rb
declare_schema-0.5.0.pre.1 lib/declare_schema.rb