Class: Chicago::Database::SchemaGenerator Private
- Inherits:
-
Object
- Object
- Chicago::Database::SchemaGenerator
- Defined in:
- lib/chicago/database/schema_generator.rb
Overview
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.
A StarSchema Visitor which produces a hash similar to the hash produced by Sequel.
Instance Attribute Summary collapse
- #type_converter ⇒ Object writeonly private
Instance Method Summary collapse
-
#initialize(type_converter) ⇒ SchemaGenerator
constructor
private
A new instance of SchemaGenerator.
- #traverse(schema) ⇒ Object private
- #visit_column(column) ⇒ Object (also: #visit_measure, #visit_dimension_reference) private
- #visit_dimension(dimension) ⇒ Object private
- #visit_fact(fact) ⇒ Object private
Constructor Details
#initialize(type_converter) ⇒ SchemaGenerator
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 a new instance of SchemaGenerator.
8 9 10 |
# File 'lib/chicago/database/schema_generator.rb', line 8 def initialize(type_converter) @type_converter = type_converter end |
Instance Attribute Details
#type_converter=(value) ⇒ Object (writeonly)
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.
6 7 8 |
# File 'lib/chicago/database/schema_generator.rb', line 6 def type_converter=(value) @type_converter = value end |
Instance Method Details
#traverse(schema) ⇒ 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.
12 13 14 |
# File 'lib/chicago/database/schema_generator.rb', line 12 def traverse(schema) schema.tables.inject({}) {|hsh,t| hsh.merge(t.visit(self)) } end |
#visit_column(column) ⇒ Object Also known as: visit_measure, visit_dimension_reference
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 |
# File 'lib/chicago/database/schema_generator.rb', line 25 def visit_column(column) column.to_hash.merge :column_type => @type_converter.db_type(column) end |
#visit_dimension(dimension) ⇒ 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.
20 21 22 23 |
# File 'lib/chicago/database/schema_generator.rb', line 20 def visit_dimension(dimension) {dimension.table_name => basic_table(dimension)}. merge!(key_table(dimension)) end |
#visit_fact(fact) ⇒ 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.
16 17 18 |
# File 'lib/chicago/database/schema_generator.rb', line 16 def visit_fact(fact) {fact.table_name => basic_table(fact)} end |