Class: Skmz::Table
- Inherits:
-
Object
- Object
- Skmz::Table
- Includes:
- ActiveModel::Model
- Defined in:
- lib/skmz/table.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/skmz/table.rb', line 4 def name @name end |
Instance Method Details
#as_json ⇒ Object
6 7 8 |
# File 'lib/skmz/table.rb', line 6 def as_json { name: name, columns: columns.as_json } end |
#columns ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/skmz/table.rb', line 10 def columns @columns ||= [].tap do |columns| ActiveRecord::Base.connection.columns(name).each do |column| columns << Column.new(name: column.name, type: column.type) end end end |