Class: TableQuery::TableSchema
- Inherits:
-
Object
- Object
- TableQuery::TableSchema
- Defined in:
- lib/table-query/table-schema.rb
Overview
TableSchema defines table fields.
Instance Attribute Summary collapse
-
#fields ⇒ Array<Field>
readonly
table field list.
Class Method Summary collapse
-
.define(&b) ⇒ TableSchema
Define a new table schema.
Instance Method Summary collapse
-
#field(name, type) ⇒ void
Add a table field.
-
#initialize ⇒ TableSchema
constructor
Create a new table schema.
Constructor Details
#initialize ⇒ TableSchema
Create a new table schema.
19 20 21 |
# File 'lib/table-query/table-schema.rb', line 19 def initialize @fields = [] end |
Instance Attribute Details
#fields ⇒ Array<Field> (readonly)
table field list
16 17 18 |
# File 'lib/table-query/table-schema.rb', line 16 def fields @fields end |
Class Method Details
.define(&b) ⇒ TableSchema
Define a new table schema.
10 11 12 |
# File 'lib/table-query/table-schema.rb', line 10 def self.define(&b) new.tap {|x| x.instance_eval(&b)} end |
Instance Method Details
#field(name, type) ⇒ void
This method returns an undefined value.
Add a table field.
30 31 32 |
# File 'lib/table-query/table-schema.rb', line 30 def field(name, type) @fields << Field.new(name, type, @fields.size, nil, {}) end |