Module: Gomon::Uri
- Included in:
- Base
- Defined in:
- lib/gomon/uri.rb
Instance Method Summary collapse
-
#parse_uri(uri) ⇒ Object
Parse mongodb uri into options.
Instance Method Details
#parse_uri(uri) ⇒ Object
Parse mongodb uri into options
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/gomon/uri.rb', line 4 def parse_uri(uri) matches = uri.match /mongodb:\/\/([^:]*):([^@]*)@([^:]*):(\d*)\/(.*)/i { :username => matches[1], :password => matches[2], :host => matches[3], :port => matches[4], :db => matches[5] } end |