URL class; is this worth submitting to RAA?

Before Ruby, I did a lot of web application programming in Perl using
Apache::ASP. Apache::ASP has a method, $Server->URL(), which
constructs a URL for me. I missed this capability in Ruby, so I made
my own class which does this.

Is this worth submitting to the RAA? It seems awfully simple. Although
pretty useful, at least for me.

Constructs a URL from a query hash.

···

Example:

irb> URL.make(‘http://test.com/’, {‘login’ => ‘pmak’, ‘name’ => ‘Philip Mak’, ‘numbers’ => [1,2,3]})

http://test.com/?name=Philip%20Mak;login=pmak;numbers=1;numbers=2;numbers=3

require ‘uri’

class URL
def self.make(base, args = {})
args = args.delete_if { |k, v| v.nil? }
if args.empty?
base
else
"#{base}?#{
args.to_a.collect { |k, v|
v.is_a?(Array) ?
v.collect { |vn|
"#{URI.escape(k.to_s)}=#{URI.escape(vn.to_s)}"
}.join(’;’) :
"#{URI.escape(k.to_s)}=#{URI.escape(v.to_s)}"
}.join(’;’)
}"
end
end
end

Why not join it with another class that is already present in the RAA?
Are there any conflicts? Here are some candidates:
http://raa.ruby-lang.org/list.rhtml?name=urb
http://raa.ruby-lang.org/list.rhtml?name=ruby-urn

And the internal class in net/http

robert

“Philip Mak” pmak@aaanime.net schrieb im Newsbeitrag
news:20030617133541.GM24190@lina.aaanime.net

Before Ruby, I did a lot of web application programming in Perl using
Apache::ASP. Apache::ASP has a method, $Server->URL(), which
constructs a URL for me. I missed this capability in Ruby, so I made
my own class which does this.

Is this worth submitting to the RAA? It seems awfully simple. Although
pretty useful, at least for me.

Constructs a URL from a query hash.

Example:

irb> URL.make(‘http://test.com/’, {‘login’ => ‘pmak’, ‘name’ =>

‘Philip Mak’, ‘numbers’ => [1,2,3]})

http://test.com/?name=Philip%20Mak;login=pmak;numbers=1;numbers=2;numbers
=3”

···

require ‘uri’

class URL
def self.make(base, args = {})
args = args.delete_if { |k, v| v.nil? }
if args.empty?
base
else
“#{base}?#{
args.to_a.collect { |k, v|
v.is_a?(Array) ?
v.collect { |vn|
“#{URI.escape(k.to_s)}=#{URI.escape(vn.to_s)}”
}.join(‘;’) :
“#{URI.escape(k.to_s)}=#{URI.escape(v.to_s)}”
}.join(‘;’)
}”
end
end
end

Why not add it here, plus example-of-usage ?

···

On Tue, 17 Jun 2003 23:35:53 +0900, Philip Mak wrote:

Is this worth submitting to the RAA? It seems awfully simple. Although
pretty useful, at least for me.


Simon Strandgaard