diff options
author | glass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-21 03:21:17 +0000 |
---|---|---|
committer | glass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-21 03:21:17 +0000 |
commit | 5be5db63503251aa900386757e1a46a99b5052ec (patch) | |
tree | a28fda5f67fb4bbb50bb7d74e86695749c8d2cd3 /lib/csv.rb | |
parent | be1206c0ace306ebfbb3ab9ddd1cfec8fee230a9 (diff) |
* 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
Diffstat (limited to 'lib/csv.rb')
-rw-r--r-- | lib/csv.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/csv.rb b/lib/csv.rb index 60b22e76ba..c56f11bcf4 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -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 |