* gc.c, parse.y, lib/cgi.rb, lib/date.rb: last minute backports from HEAD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-07-14 14:22:11 +00:00
parent 91c9ac216a
commit 6e918be6b1
5 changed files with 23 additions and 17 deletions

View file

@ -1125,17 +1125,16 @@ class CGI
@multipart
end
class Value < DelegateClass(String) # :nodoc:
def initialize(str, params)
module Value # :nodoc:
def set_params(params)
@params = params
super(str)
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']"
self
@params[idx]
else
self.to_s[idx,*args]
super[idx,*args]
end
end
def first
@ -1165,7 +1164,10 @@ class CGI
Tempfile.new("CGI")
end
else
Value.new(value || "", params)
str = if value then value.dup else "" end
str.extend(Value)
str.set_params(params)
str
end
end
@ -2310,4 +2312,3 @@ class CGI
end
end # class CGI