Class: RailsDbInfo::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name) ⇒ Table

Returns a new instance of Table.



6
7
8
# File 'lib/rails_db_info/table.rb', line 6

def initialize(table_name)
  @name = table_name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rails_db_info/table.rb', line 4

def name
  @name
end

Instance Method Details

#column_propertiesObject



14
15
16
# File 'lib/rails_db_info/table.rb', line 14

def column_properties
  %w(name sql_type null limit precision scale type default primary coder)
end

#columnsObject



10
11
12
# File 'lib/rails_db_info/table.rb', line 10

def columns
  connection.columns(name)
end

#to_paramObject



18
19
20
# File 'lib/rails_db_info/table.rb', line 18

def to_param
  name
end