Module: Torque::PostgreSQL::Coder

Defined in:
lib/torque/postgresql/coder.rb

Constant Summary collapse

Record =

This class represents an Record to be encoded, instead of a literal Array

Class.new(Array)
NEED_QUOTE_FOR =
/[\\"(){}, \t\n\r\v\f]/m
DELIMITER =
','

Class Method Summary collapse

Class Method Details

.decode(value) ⇒ Object

This method replace the read_array method from PG gem See github.com/ged/ruby-pg/blob/master/ext/pg_text_decoder.c#L177 for more information



18
19
20
21
22
# File 'lib/torque/postgresql/coder.rb', line 18

def decode(value)
  # TODO: Use StringScanner
  # See http://ruby-doc.org/stdlib-1.9.3/libdoc/strscan/rdoc/StringScanner.html
  _decode(::StringIO.new(value))
end

.encode(value) ⇒ Object

This method replace the ++ method from PG gem See github.com/ged/ruby-pg/blob/master/ext/pg_text_encoder.c#L398 for more information



27
28
29
# File 'lib/torque/postgresql/coder.rb', line 27

def encode(value)
  _encode(value)
end