Hello all, I recently messed around with modifying Ruby's CGI class in order
to make it return strings instead of arrays. The code to do so was simple:
require 'cgi'
class CGI
module QueryExtension
def [](*args)
if @params[*args]
return @params[*args][0]
end
end
end
end
This works well except that modruby caches classes, so all of my old Ruby
CGI programs break when they get strings instead of their expected arrays
since they're using the cached copy of the new CGI class. My solution
to this problem was to create a derived class from CGI and us it in all
my new programs. I called it SCGI(scalar cgi), but I can't get it to work.
Here's my implementation:
require 'cgi'
class SCGI < CGI
module QueryExtension
def [](*args)
if @params[*args]
return @params[*args][0]
end
end
end
end
When I create an instance of it, it still returns all params as arrays instead
of strings. Am I missing something totally obvious here?
Thanks,
Travis Whitton <whitton / atlantic.net>