Fast PostreSQL array parsing.
Add this line to your application's Gemfile:
gem 'pg_array_parser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pg_array_parser
Include the PgArrayParser
module, which provides the parse_pg_array
method.
class MyPostgresParser
include PgArrayParser
end
parser = MyPostgresParser.new
parser.parse_pg_array '{}'
# => []
parser.parse_pg_array '{1,2,3,4}'
# => ["1", "2", "3", "4"]
parser.parse_pg_array '{1,{2,3},4}'
# => ["1", ["2", "3"], "4"]
parser.parse_pg_array '{some,strings that,"May have some ,\'s"}'
# => ["some", "strings that", "May have some ,'s"]
This gem follows Semantic Versioning
Stable branches are created based upon each minor version. Please make pull requests to specific branches rather than master.
Please make sure you include tests!
Unles Rails drops support for Ruby 1.8.7 we will continue to use the hash-rocket syntax. Please respect this.
Don't use tabs to indent, two spaces are the standard.
DockYard, LLC © 2012