Module: TableStructure::Schema
- Defined in:
- lib/table_structure/schema.rb,
lib/table_structure/schema/table.rb,
lib/table_structure/schema/utils.rb,
lib/table_structure/schema/definition.rb,
lib/table_structure/schema/dsl/option.rb,
lib/table_structure/schema/column/attrs.rb,
lib/table_structure/schema/column/schema.rb,
lib/table_structure/schema/result_builders.rb,
lib/table_structure/schema/context_builders.rb,
lib/table_structure/schema/definition/error.rb,
lib/table_structure/schema/column_converters.rb,
lib/table_structure/schema/dsl/result_builder.rb,
lib/table_structure/schema/definition/compiler.rb,
lib/table_structure/schema/dsl/context_builder.rb,
lib/table_structure/schema/table/key_decorator.rb,
lib/table_structure/schema/definition/validator.rb,
lib/table_structure/schema/dsl/column_converter.rb,
lib/table_structure/schema/dsl/column_definition.rb
Defined Under Namespace
Modules: Column, DSL, Utils
Classes: ColumnConverter, ColumnConverters, ContextBuilder, ContextBuilders, Definition, ResultBuilder, ResultBuilders, Table
Constant Summary
collapse
- DEFAULT_OPTIONS =
{
name_prefix: nil,
name_suffix: nil,
key_prefix: nil,
key_suffix: nil,
nil_definitions_ignored: false
}.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
Instance Method Details
#create_table(**options) ⇒ Object
39
40
41
|
# File 'lib/table_structure/schema.rb', line 39
def create_table(**options)
@table_structure_schema_definition_.create_table(options)
end
|
#initialize(context: nil, name: self.class.name, **options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/table_structure/schema.rb', line 21
def initialize(context: nil, name: self.class.name, **options)
column_definitions = [].concat(self.class.column_definitions)
context_builders = {}.merge!(self.class.context_builders)
column_converters = {}.merge!(self.class.column_converters)
result_builders = {}.merge!(self.class.result_builders)
options = DEFAULT_OPTIONS.merge(self.class.options).merge(options)
@table_structure_schema_definition_ =
Definition.new(
name,
column_definitions,
context_builders,
column_converters,
result_builders,
context,
options
)
end
|