mongodb/mongo-ruby-driver — pull request #106 by johnbintz (2012-06-05 21:45:43+00:00)
Title: Add Connection#db_from_uri to round out MONGODB_URI support

The new `ENV['MONGODB_URI']` support does everything but allow you to automatically connect to the database name provided in the URI. This pull adds `Mongo::Connection#db_from_uri` which returns a `Mongo::DB` named after the database name given in `ENV['MONGODB_URI']`:

``` ruby
ENV['MONGODB_URI'] = 'mongodb://my.database.host/database'

conn = Mongo::Connection.new
db = conn.db_from_uri
db.name #=> "database"
```