# File lib/couchrest.rb, line 90
    def parse url
      case url
      when /^http:\/\/(.*)\/(.*)\/(.*)/
        host = $1
        db = $2
        docid = $3
      when /^http:\/\/(.*)\/(.*)/
        host = $1
        db = $2
      when /^http:\/\/(.*)/
        host = $1
      when /(.*)\/(.*)\/(.*)/
        host = $1
        db = $2
        docid = $3
      when /(.*)\/(.*)/
        host = $1
        db = $2
      else
        db = url
      end

      db = nil if db && db.empty?

      {
        :host => host || "127.0.0.1:5984",
        :database => db,
        :doc => docid
      }
    end