Module: SQLite3::Query::Description
- Defined in:
- lib/sqlite3/query.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
Instance Method Summary collapse
-
#data_table ⇒ Object
A Google Chart compatible data table; see developers.google.com/chart/interactive/docs/reference#dataparam.
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
57 58 59 |
# File 'lib/sqlite3/query.rb', line 57 def columns @columns end |
Instance Method Details
#data_table ⇒ Object
A Google Chart compatible data table; see developers.google.com/chart/interactive/docs/reference#dataparam
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sqlite3/query.rb', line 61 def data_table cols = columns.map do |column| type = case column when /_at$/ then :datetime when /_on$/ then :date when /value/ then :number else :string end { id: column, type: type, label: column } end rows = map { |record| convert_record record, cols } { cols: cols, rows: rows } end |