From: matz@... (Yukihiro Matsumoto) Date: 2002-05-15T05:22:00+09:00 Subject: Re: cgi params api Hi, In message "Re: cgi params api" on 02/05/14, Wakou Aoyama writes: |test_arg = {"key1" => ["val1", "val2"], "key2"=>["val1", "val2"]} |cgi = CGI.new(test_arg) |p cgi["key1"] # "val1" |p cgi["key1"] == "val1" # true |p cgi["key1"].to_s # "val1" |p cgi["key1"].to_a # ["val1", "val2"] |p cgi["key1"].type # CGI::Param |p cgi["key1"][0] # "val1" backward compatibility ;-> |p cgi["key1"][1] # "val2" | |How about this? Unless you really really seek compatibility, faking something behave like both Array and String tends to cause trouble. For 99.8% of the cases, we get single value for a prarameter. So how about making cgi["key"] just return a string, and prepare advanced API (say, CGI#params(key)) if one requires a multiple valued parameter. matz.