Class: Simple::SQL::Helpers::Decoder::HashRecord
- Inherits:
-
MultiColumns
- Object
- MultiColumns
- Simple::SQL::Helpers::Decoder::HashRecord
- Defined in:
- lib/simple/sql/helpers/decoder.rb
Instance Method Summary collapse
- #decode(row) ⇒ Object
-
#initialize(connection, result) ⇒ HashRecord
constructor
A new instance of HashRecord.
Constructor Details
#initialize(connection, result) ⇒ HashRecord
Returns a new instance of HashRecord.
105 106 107 108 |
# File 'lib/simple/sql/helpers/decoder.rb', line 105 def initialize(connection, result) super(connection, result) @field_names = result.fields.map(&:to_sym) end |
Instance Method Details
#decode(row) ⇒ Object
110 111 112 113 |
# File 'lib/simple/sql/helpers/decoder.rb', line 110 def decode(row) decoded_row = super(row) Hash[@field_names.zip(decoded_row)] end |