ruby-pg-url /

Filename Size Date modified Message
1.2 KB
630 B
734 B
1.8 KB


This module allows a database connection using rugy-pg to be established using a URL.


require 'pg'
require 'rubypgurl'

spec = RubyPgURL.parse(ENV['DATABASE_URL'] || raise("DATABASE_URL not set"))
conn = PG.connect(spec)


cp rubypgurl.rb $MYPROJECT/lib/

Supported Features

  • Standard postgresql:// URI syntax
  • Arbitrary parameters specified in the query string
  • Unix domain sockets with percent encoding (requires Ruby >= 2.2)