From: "とみたまさひろ" Date: 2008-02-04T07:57:54+09:00 Subject: [ruby-dev:33583] Re: cgi.rb再構築案 とみたです。 根本的な問題の解決の話ではないですけど、CGI#[] が返すのは普通の文字列に して、CGI#[][] とかで warning が出るのは、1.9 ではもうやめましょう。 Index: lib/cgi.rb =================================================================== --- lib/cgi.rb (リビジョン 15370) +++ lib/cgi.rb (作業コピー) @@ -1178,29 +1178,6 @@ @multipart end - module Value # :nodoc: - def set_params(params) - @params = params - end - def [](idx, *args) - if args.size == 0 - warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']" - @params[idx] - else - super[idx,*args] - end - end - def first - warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']" - self - end - alias last first - def to_a - @params || [self] - end - alias to_ary to_a # to be rhs of multiple assignment - end - # Get the value for the parameter with a given key. # # If the parameter has multiple values, only the first will be @@ -1219,8 +1196,6 @@ end else str = if value then value.dup else "" end - str.extend(Value) - str.set_params(params) str end end -- とみたまさひろ 3469 42CC 4D32 F53C AD98 65A5 8C37 FF09 69C1 6040