1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi/cookie.rb (CGI::Cookie#to_s): performance improvement

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2008-09-10 01:36:31 +00:00
parent 3293f6cfb9
commit 0bedb3e5b1
2 changed files with 11 additions and 25 deletions

View file

@ -1,3 +1,8 @@
Wed Sep 10 10:35:32 2008 Takeyuki Fujioka <xibbar@ruby-lang.org>
* lib/cgi/cookie.rb (CGI::Cookie#to_s): performance improvement
from http://jp.rubyist.net/magazine/?0023-Cgirb.
Wed Sep 10 10:12:29 2008 akira yamada <akira@arika.org>
* lib/sync.rb (Sync_m#sync_exclusive): fixed

View file

@ -96,31 +96,12 @@ class CGI
# Convert the Cookie to its string representation.
def to_s
buf = ""
buf += @name + '='
if @value.kind_of?(String)
buf += CGI::escape(@value)
else
buf += @value.collect{|v| CGI::escape(v) }.join("&")
end
if @domain
buf += '; domain=' + @domain
end
if @path
buf += '; path=' + @path
end
if @expires
buf += '; expires=' + CGI::rfc1123_date(@expires)
end
if @secure == true
buf += '; secure'
end
val = @value.kind_of?(String) ? CGI::escape(@value) : @value.collect{|v| CGI::escape(v) }.join("&")
buf = "#{@name}=#{val}"
buf << "; domain=#{@domain}" if @domain
buf << "; path=#{@path}" if @path
buf << "; expires=#{CGI::rfc1123_date(@expires)}" if @expires
buf << "; secure" if @secure == true
buf
end