Class: Fresco::SchemaBuilder
- Inherits:
-
Object
- Object
- Fresco::SchemaBuilder
- Defined in:
- lib/fresco/schema_builder.rb
Instance Attribute Summary collapse
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#initialize ⇒ SchemaBuilder
constructor
A new instance of SchemaBuilder.
- #table(name, &blk) ⇒ Object
Constructor Details
#initialize ⇒ SchemaBuilder
Returns a new instance of SchemaBuilder.
35 36 37 |
# File 'lib/fresco/schema_builder.rb', line 35 def initialize @tables = [] end |
Instance Attribute Details
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
33 34 35 |
# File 'lib/fresco/schema_builder.rb', line 33 def tables @tables end |
Instance Method Details
#table(name, &blk) ⇒ Object
39 40 41 42 43 |
# File 'lib/fresco/schema_builder.rb', line 39 def table(name, &blk) tb = Fresco::TableBuilder.new(name) tb.instance_eval(&blk) if blk @tables << { name: name, columns: tb.columns, foreign_keys: tb.foreign_keys } end |