Class: Baza::Column
Instance Method Summary
collapse
#model_name, #to_model
Instance Method Details
#after ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/baza/column.rb', line 20
def after
last = nil
table.columns.each do |column|
break if column.name == name
last = column.name
end
last
end
|
#data ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/baza/column.rb', line 30
def data
{
type: type,
name: name,
null: null?,
maxlength: maxlength,
default: default,
primarykey: primarykey?,
autoincr: autoincr?
}
end
|
#inspect ⇒ Object
8
9
10
|
# File 'lib/baza/column.rb', line 8
def inspect
to_s
end
|
#table ⇒ Object
16
17
18
|
# File 'lib/baza/column.rb', line 16
def table
@db.tables[table_name]
end
|
#to_param ⇒ Object
12
13
14
|
# File 'lib/baza/column.rb', line 12
def to_param
name
end
|
#to_s ⇒ Object
4
5
6
|
# File 'lib/baza/column.rb', line 4
def to_s
"#<#{self.class.name} name=\"#{name}\" type=\"#{type}\" maxlength=\"#{maxlength}\" autoincr=\"#{autoincr?}\" primarykey=\"#{primarykey?}\">"
end
|