PGArray subclass handling integer and float types, using a fast JSON parser. Does not handle numeric/decimal types, since JSON does deal with arbitrary precision (see PGDecimalArray for that).
Character conversion map mapping input strings to JSON replacements
Regular expression matching input strings to convert
Parse the input string by using a gsub to convert non-JSON characters to JSON, running it through a regular JSON parser, and the doing a recursive map over the output to make sure the entries are in the correct type (mostly, to make sure real/double precision database types are returned as float and not integer).
# File lib/sequel/extensions/pg_array.rb, line 349 def self.parse(string, type=nil) new(recursive_map(JSON.parse(string.gsub(SUBST_RE){|m| SUBST[m]})), type) end