Class: Simple::SQL::Decoder::MultiColumns
- Inherits:
-
Object
- Object
- Simple::SQL::Decoder::MultiColumns
- Defined in:
- lib/simple/sql/decoder.rb
Direct Known Subclasses
Instance Method Summary collapse
- #decode(row) ⇒ Object
-
#initialize(result) ⇒ MultiColumns
constructor
A new instance of MultiColumns.
Constructor Details
#initialize(result) ⇒ MultiColumns
Returns a new instance of MultiColumns.
81 82 83 84 85 86 |
# File 'lib/simple/sql/decoder.rb', line 81 def initialize(result) @field_types = 0.upto(result.fields.length - 1).map do |idx| typename = ::Simple::SQL.send(:resolve_type, result.ftype(idx), result.fmod(idx)) typename.to_sym end end |
Instance Method Details
#decode(row) ⇒ Object
88 89 90 91 92 |
# File 'lib/simple/sql/decoder.rb', line 88 def decode(row) @field_types.zip(row).map do |field_type, value| value && Simple::SQL::Decoder.decode_value(field_type, value) end end |