Skip to content

Commit 9907b76

Browse files
hsbtmame
andcommitted
Use String#concat instead of String#+ for reducing cpu usage
Co-authored-by: "Yusuke Endoh" <mame@ruby-lang.org>
1 parent 8e6fb10 commit 9907b76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/cgi/cookie.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ def self.parse(raw_cookie)
190190
values ||= ""
191191
values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
192192
if cookies.has_key?(name)
193-
values = cookies[name].value + values
193+
cookies[name].concat(values)
194+
else
195+
cookies[name] = Cookie.new(name, *values)
194196
end
195-
cookies[name] = Cookie.new(name, *values)
196197
end
197198

198199
cookies

0 commit comments

Comments
 (0)