On Sat, 8 Feb 2003, Wakou Aoyama wrote:

> hello,
>
> require "cgi"
> q = CGI.new.query
> p q.key  # ==> "value"
>
> How about this?


http://messyquerystrings.com/%20key%20with%20spaces=value

??

  q.key_with_spaces  perhaps??

http://messyquerystrings.com/%2fkey%2fwith%2fslashes=value

  q.key/with/slashes perhaps??

??

how will those work as method names?

-a

>
>
>
> -----
> class CGI
>   class Query
>     def initialize(params)
>       @params = params
>     end
>     def method_missing(key)
>       @params[key.to_s].first
>     end
>   end
>   def query
>     CGI::Query.new(@params)
>   end
> end
>
> cgi = CGI.new
> q = cgi.query
> p q.key  # ==> "value"
>
>
>

-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================