Class: Friendly::TableCreator
- Inherits:
-
Object
- Object
- Friendly::TableCreator
- Defined in:
- lib/friendly/table_creator.rb
Instance Attribute Summary (collapse)
-
- (Object) attr_klass
readonly
Returns the value of attribute attr_klass.
-
- (Object) db
readonly
Returns the value of attribute db.
Instance Method Summary (collapse)
- - (Object) create(table)
-
- (TableCreator) initialize(db = Friendly.db, attr_klass = Friendly::Attribute)
constructor
A new instance of TableCreator.
Constructor Details
- (TableCreator) initialize(db = Friendly.db, attr_klass = Friendly::Attribute)
A new instance of TableCreator
5 6 7 8 |
# File 'lib/friendly/table_creator.rb', line 5 def initialize(db = Friendly.db, attr_klass = Friendly::Attribute) @db = db @attr_klass = attr_klass end |
Instance Attribute Details
- (Object) attr_klass (readonly)
Returns the value of attribute attr_klass
3 4 5 |
# File 'lib/friendly/table_creator.rb', line 3 def attr_klass @attr_klass end |
- (Object) db (readonly)
Returns the value of attribute db
3 4 5 |
# File 'lib/friendly/table_creator.rb', line 3 def db @db end |
Instance Method Details
- (Object) create(table)
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/friendly/table_creator.rb', line 10 def create(table) unless db.table_exists?(table.table_name) case table when DocumentTable create_document_table(table) when Index create_index_table(table) end end end |