Sha256: 3566d07c1026ba4d2739b05e9e7c95b41cfa7c28bc9f95da9da4a5013f7ee734

Contents?: true

Size: 503 Bytes

Versions: 19

Compression:

Stored size: 503 Bytes

Contents

require 'dry-types'

module ROM
  module Types
    include Dry::Types.module

    def self.included(other)
      other.extend(Methods)
      super
    end

    def self.Definition(primitive)
      Dry::Types::Definition.new(primitive)
    end

    def self.Constructor(primitive, &block)
      Types.Definition(primitive).constructor(&block)
    end

    module Methods
      def ForeignKey(relation, type = Types::Int)
        type.meta(foreign_key: true, target: relation)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
rom-core-4.0.0.beta3 lib/rom/types.rb
rom-3.3.1 lib/rom/types.rb
rom-core-4.0.0.beta2 lib/rom/types.rb
rom-3.3.0 lib/rom/types.rb
rom-core-4.0.0.beta1 lib/rom/types.rb
rom-3.2.3 lib/rom/types.rb
rom-3.2.2 lib/rom/types.rb
rom-3.2.1 lib/rom/types.rb
rom-3.2.0 lib/rom/types.rb
rom-3.1.0 lib/rom/types.rb
rom-3.0.3 lib/rom/types.rb
rom-3.0.2 lib/rom/types.rb
rom-3.0.1 lib/rom/types.rb
rom-3.0.0 lib/rom/types.rb
rom-3.0.0.rc2 lib/rom/types.rb
rom-3.0.0.rc1 lib/rom/types.rb
rom-3.0.0.beta3 lib/rom/types.rb
rom-3.0.0.beta2 lib/rom/types.rb
rom-3.0.0.beta1 lib/rom/types.rb