From 9e5bc61c60f8775150163d6d2da73d60083f0dbd Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 15 Jun 2023 09:20:31 +0200 Subject: Fix Lint/UnusedBlockArgument offenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use `each_value` instead of `each` where possible. The performance gain is minimal (3%). ``` Comparison: each_value: 4105733.4 i/s each: 3998011.4 i/s - 1.03x (± 0.00) slower ``` --- lib/axlsx/workbook/worksheet/pivot_table.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/axlsx/workbook/worksheet/pivot_table.rb') diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb index a75842cd..97c4515b 100644 --- a/lib/axlsx/workbook/worksheet/pivot_table.rb +++ b/lib/axlsx/workbook/worksheet/pivot_table.rb @@ -210,7 +210,7 @@ module Axlsx end str << '' str << '' - rows.size.times do |i| + rows.size.times do str << '' end str << '' @@ -220,7 +220,7 @@ module Axlsx str << '' str << "" str << '' - data[1..-1].each_with_index do |datum_value, i| + (data.size - 1).times do |i| str << "" end str << '' -- cgit v1.2.3