Class: Radical::Table
- Inherits:
-
Object
- Object
- Radical::Table
- Defined in:
- lib/radical/table.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
Instance Method Summary collapse
-
#initialize(table) ⇒ Table
constructor
A new instance of Table.
- #integer(name) ⇒ Object
- #string(name) ⇒ Object
- #timestamps ⇒ Object
Constructor Details
#initialize(table) ⇒ Table
Returns a new instance of Table.
7 8 9 10 |
# File 'lib/radical/table.rb', line 7 def initialize(table) @table = table @columns = [] end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
5 6 7 |
# File 'lib/radical/table.rb', line 5 def columns @columns end |
Instance Method Details
#integer(name) ⇒ Object
16 17 18 |
# File 'lib/radical/table.rb', line 16 def integer(name) @columns << "#{name} integer" end |
#string(name) ⇒ Object
12 13 14 |
# File 'lib/radical/table.rb', line 12 def string(name) @columns << "#{name} text" end |
#timestamps ⇒ Object
20 21 22 23 |
# File 'lib/radical/table.rb', line 20 def @columns << "created_at integer not null default(strftime('%s', 'now'))" @columns << 'updated_at integer' end |