Class: Radical::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/radical/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#columnsObject

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

#timestampsObject



20
21
22
23
# File 'lib/radical/table.rb', line 20

def timestamps
  @columns << "created_at integer not null default(strftime('%s', 'now'))"
  @columns << 'updated_at integer'
end