Class: Eatr::Sql::TableGenerator
- Inherits:
-
Object
- Object
- Eatr::Sql::TableGenerator
- Defined in:
- lib/eatr/sql/table_generator.rb
Instance Method Summary collapse
-
#initialize(schema_path) ⇒ TableGenerator
constructor
A new instance of TableGenerator.
- #statement ⇒ Object
Constructor Details
#initialize(schema_path) ⇒ TableGenerator
Returns a new instance of TableGenerator.
4 5 6 |
# File 'lib/eatr/sql/table_generator.rb', line 4 def initialize(schema_path) @schema = Schema.new(YAML.load(File.read(schema_path))) end |
Instance Method Details
#statement ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/eatr/sql/table_generator.rb', line 8 def statement <<-STATEMENT CREATE TABLE #{@schema.table_name} ( #{column_defs.join(",\n ")} ); STATEMENT end |