Class: Simple::SQL::Helpers::Decoder::SingleColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/simple/sql/helpers/decoder.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, result) ⇒ SingleColumn

Returns a new instance of SingleColumn.



78
79
80
81
# File 'lib/simple/sql/helpers/decoder.rb', line 78

def initialize(connection, result)
  typename = connection.resolve_type(result.ftype(0), result.fmod(0))
  @field_type = typename.to_sym
end

Instance Method Details

#decode(row) ⇒ Object



83
84
85
86
# File 'lib/simple/sql/helpers/decoder.rb', line 83

def decode(row)
  value = row.first
  value && Simple::SQL::Helpers::Decoder.decode_value(@field_type, value)
end