Class: ROM::Components::Schema

Inherits:
Core
  • Object
show all
Defined in:
lib/rom/components/schema.rb

Instance Method Summary collapse

Instance Method Details

#adapterObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
# File 'lib/rom/components/schema.rb', line 46

def adapter
  config.adapter
end

#buildObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rom/components/schema.rb', line 17

def build
  if view?
    registry.schemas[config.relation].instance_eval(&block)
  else
    schema = config.constant.define(
      name, **config, **config.options, inferrer: inferrer, registry: registry
    )

    if gateway?
      schema.finalize_attributes!(gateway: gateway)
    else
      schema.finalize_attributes!
    end

    schema.finalize!
  end
end

#datasetObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/rom/components/schema.rb', line 41

def dataset
  config.dataset
end

#inferrerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/rom/components/schema.rb', line 36

def inferrer
  config.inferrer.with(enabled: config.infer)
end

#relationObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
# File 'lib/rom/components/schema.rb', line 51

def relation
  config.relation
end

#view?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


56
57
58
# File 'lib/rom/components/schema.rb', line 56

def view?
  config.view.equal?(true)
end