Class: ROM::SQL::Schema::DSL

Inherits:
ROM::Schema::DSL
  • Object
show all
Defined in:
lib/rom/sql/schema/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#associations_dslObject (readonly)

Returns the value of attribute associations_dsl.



8
9
10
# File 'lib/rom/sql/schema/dsl.rb', line 8

def associations_dsl
  @associations_dsl
end

Instance Method Details

#associations(&block) ⇒ Object



10
11
12
# File 'lib/rom/sql/schema/dsl.rb', line 10

def associations(&block)
  @associations_dsl = AssociationsDSL.new(name, &block)
end

#callObject



14
15
16
# File 'lib/rom/sql/schema/dsl.rb', line 14

def call
  SQL::Schema.new(name, attributes, opts)
end

#optsObject



18
19
20
21
22
23
24
25
26
# File 'lib/rom/sql/schema/dsl.rb', line 18

def opts
  opts = { inferrer: inferrer }

  if associations_dsl
    { **opts, associations: associations_dsl.call }
  else
    opts
  end
end