Module: Torque::PostgreSQL::Coder

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

Defined Under Namespace

Classes: Record

Constant Summary collapse

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

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



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

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



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

def encode(value)
  _encode(value)
end