# File lib/data_objects/uri.rb, line 14 def to_s string = "" string << "#{scheme}://" if scheme if user string << "#{user}" string << ":#{password}" if password string << "@" end string << "#{host}" if host string << ":#{port}" if port string << path.to_s if query string << "?" << query.map do |key, value| "#{key}=#{value}" end.join("&") end string << "##{fragment}" if fragment string end