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

* lib/csv.rb: avoid unnecessary object allocations.

patch is from Andrew Vit. [ruby-core:63215] [Feature #9952]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2014-09-21 03:21:17 +00:00
parent be1206c0ac
commit 5be5db6350
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sat Sep 20 04:42:18 2014 Masaki Matsushita <glass.saga@gmail.com>
* lib/csv.rb: avoid unnecessary object allocations.
patch is from Andrew Vit. [ruby-core:63215] [Feature #9952]
Sun Sep 21 12:10:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/rexml/**/*.rb: removed commented-out code.

View file

@ -238,10 +238,10 @@ class CSV
headers.each { |h| h.freeze if h.is_a? String }
# handle extra headers or fields
@row = if headers.size > fields.size
@row = if headers.size >= fields.size
headers.zip(fields)
else
fields.zip(headers).map { |pair| pair.reverse }
fields.zip(headers).map { |pair| pair.reverse! }
end
end