Class: TableSaw::Queries::TableColumns
- Inherits:
-
Object
- Object
- TableSaw::Queries::TableColumns
- Defined in:
- lib/table_saw/queries/table_columns.rb
Constant Summary collapse
- QUERY =
"select attname as colname\nfrom pg_catalog.pg_attribute\nwhere\n attrelid = $1::regclass\n and attnum > 0\n and attisdropped = false\norder by attnum\n"
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(table) ⇒ TableColumns
constructor
A new instance of TableColumns.
Constructor Details
#initialize(table) ⇒ TableColumns
Returns a new instance of TableColumns.
20 21 22 |
# File 'lib/table_saw/queries/table_columns.rb', line 20 def initialize(table) @table = table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
18 19 20 |
# File 'lib/table_saw/queries/table_columns.rb', line 18 def table @table end |
Instance Method Details
#call ⇒ Object
24 25 26 |
# File 'lib/table_saw/queries/table_columns.rb', line 24 def call TableSaw::Connection.with { |conn| conn.exec_params(QUERY, [table]) }.map { |r| r['colname'] } end |