Class: Simple::SQL::Helpers::Decoder::HashRecord
- Inherits:
-
MultiColumns
- Object
- MultiColumns
- Simple::SQL::Helpers::Decoder::HashRecord
- Defined in:
- lib/simple/sql/helpers/decoder.rb
Constant Summary collapse
Instance Method Summary collapse
- #decode(row) ⇒ Object
-
#initialize(column_info) ⇒ HashRecord
constructor
A new instance of HashRecord.
Constructor Details
#initialize(column_info) ⇒ HashRecord
Returns a new instance of HashRecord.
113 114 115 116 |
# File 'lib/simple/sql/helpers/decoder.rb', line 113 def initialize(column_info) super(column_info) @field_names = H.pluck(column_info, :name) end |
Instance Method Details
#decode(row) ⇒ Object
118 119 120 121 |
# File 'lib/simple/sql/helpers/decoder.rb', line 118 def decode(row) decoded_row = super(row) Hash[@field_names.zip(decoded_row)] end |