Class: ROM::SQL::Schema::Inferrer Private
- Inherits:
-
Object
- Object
- ROM::SQL::Schema::Inferrer
- Extended by:
- ClassMacros
- Defined in:
- lib/rom/sql/schema/inferrer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .[](type) ⇒ Object private
- .get(type) ⇒ Object private
- .inherited(klass) ⇒ Object private
Instance Method Summary collapse
- #call(dataset, gateway) ⇒ Object private
Class Method Details
.[](type) ⇒ Object
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.
31 32 33 |
# File 'lib/rom/sql/schema/inferrer.rb', line 31 def self.[](type) Class.new(self) { db_type(type) } end |
.get(type) ⇒ Object
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.
35 36 37 |
# File 'lib/rom/sql/schema/inferrer.rb', line 35 def self.get(type) db_registry[type] end |
.inherited(klass) ⇒ Object
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.
25 26 27 28 29 |
# File 'lib/rom/sql/schema/inferrer.rb', line 25 def self.inherited(klass) super Inferrer.db_registry[klass.db_type] = klass unless klass.name.nil? end |
Instance Method Details
#call(dataset, gateway) ⇒ Object
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.
40 41 42 43 44 45 46 47 48 |
# File 'lib/rom/sql/schema/inferrer.rb', line 40 def call(dataset, gateway) columns = gateway.connection.schema(dataset) fks = fks_for(gateway, dataset) columns.each_with_object({}) do |(name, definition), attrs| type = build_type(definition.merge(foreign_key: fks[name])) attrs[name] = type.(name: name) end end |