A parser for PostgreSQL DSNs
Add this line to your application's Gemfile:
gem 'pg-dsn_parser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pg-dsn_parser
require 'pg/dsn_parser'
parser = PG::DSNParser.new
parser.parse("host=localhost user=username dbname='postgres' port = 5432")
# => {:host=>"localhost", :user=>"username", :dbname=>"postgres", :port=>"5432"}
The gem is available as open source under the terms of the Apache License 2.0.
Bug reports and pull requests are welcome on GitHub at https://github.com/ManageIQ/pg-dsn_parser.