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:
parent
be1206c0ac
commit
5be5db6350
2 changed files with 7 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue