Module: Postgres::Conversion

Included in:
TC_Conversion
Defined in:
lib/postgres-pr/typeconv/conv.rb,
lib/postgres-pr/typeconv/array.rb

Defined Under Namespace

Classes: ConversionError

Instance Method Summary collapse

Instance Method Details

#decode_array(str, delim = ',', &conv_proc) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/postgres-pr/typeconv/array.rb', line 5

def decode_array(str, delim=',', &conv_proc)
  delim = Regexp.escape(delim)
  buf = StringScanner.new(str)
  return parse_arr(buf, delim, &conv_proc)
ensure
  raise ConversionError, "end of string expected (#{buf.rest})" unless buf.empty?
end