Class: Simple::SQL::Helpers::Decoder::MultiColumns
- Inherits:
-
Object
- Object
- Simple::SQL::Helpers::Decoder::MultiColumns
- Defined in:
- lib/simple/sql/helpers/decoder.rb
Direct Known Subclasses
Instance Method Summary collapse
- #decode(row) ⇒ Object
-
#initialize(connection, result) ⇒ MultiColumns
constructor
A new instance of MultiColumns.
Constructor Details
#initialize(connection, result) ⇒ MultiColumns
Returns a new instance of MultiColumns.
90 91 92 93 94 95 |
# File 'lib/simple/sql/helpers/decoder.rb', line 90 def initialize(connection, result) @field_types = 0.upto(result.fields.length - 1).map do |idx| typename = connection.resolve_type(result.ftype(idx), result.fmod(idx)) typename.to_sym end end |
Instance Method Details
#decode(row) ⇒ Object
97 98 99 100 101 |
# File 'lib/simple/sql/helpers/decoder.rb', line 97 def decode(row) @field_types.zip(row).map do |field_type, value| value && Simple::SQL::Helpers::Decoder.decode_value(field_type, value) end end |