Class: Cequel::Schema::TableWriter
- Inherits:
-
Object
- Object
- Cequel::Schema::TableWriter
- Defined in:
- lib/cequel/schema/table_writer.rb
Overview
Creates a new table schema in the database
Class Method Summary collapse
-
.apply(keyspace, table) ⇒ void
Creates a new table schema in the database given an object representation of the schema to create.
Instance Method Summary collapse
-
#apply(keyspace) ⇒ void
private
Create the table in the keyspace.
-
#initialize(table) ⇒ TableWriter
constructor
A new instance of TableWriter.
- #statements ⇒ Object
Constructor Details
#initialize(table) ⇒ TableWriter
Returns a new instance of TableWriter.
23 24 25 |
# File 'lib/cequel/schema/table_writer.rb', line 23 def initialize(table) @table = table end |
Class Method Details
.apply(keyspace, table) ⇒ void
This method returns an undefined value.
Creates a new table schema in the database given an object representation of the schema to create
15 16 17 |
# File 'lib/cequel/schema/table_writer.rb', line 15 def self.apply(keyspace, table) new(table).apply(keyspace) end |
Instance Method Details
#apply(keyspace) ⇒ void
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.
This method returns an undefined value.
Create the table in the keyspace
34 35 36 |
# File 'lib/cequel/schema/table_writer.rb', line 34 def apply(keyspace) statements.each { |statement| keyspace.execute(statement) } end |
#statements ⇒ Object
38 39 40 |
# File 'lib/cequel/schema/table_writer.rb', line 38 def statements [create_statement] + index_statements end |