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(column_info) ⇒ SingleColumn

Returns a new instance of SingleColumn.



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

def initialize(column_info)
  @field_type = column_info.first.fetch(:pg_type_name)
end

Instance Method Details

#decode(row) ⇒ Object



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

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