Class: Velocity::PostgreSQLResult::PostgreSQLMappedRow
- Defined in:
- lib/velocity/results/postgresql.rb
Instance Attribute Summary
Attributes inherited from MappedRow
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(pg_query) ⇒ PostgreSQLMappedRow
constructor
A new instance of PostgreSQLMappedRow.
Methods inherited from MappedRow
Constructor Details
#initialize(pg_query) ⇒ PostgreSQLMappedRow
Returns a new instance of PostgreSQLMappedRow.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/velocity/results/postgresql.rb', line 5 def initialize(pg_query) @fields = pg_query.fields @pg_query = pg_query # It is imperitive that the adapter return the array in the same sequence of fields provided above # If this isn't the case, some re-ordering of the field KEYS should take place @fields.each_with_index do |field, index| define_singleton_method(field) do pg_query.getvalue(@tuple, index) end end end |
Instance Method Details
#attributes ⇒ Object
18 19 20 |
# File 'lib/velocity/results/postgresql.rb', line 18 def attributes @pg_query[@tuple] # Try to avoid calling this, its relatively slow. end |