From 1eb9c45c20f2b459ffdb562507e2b6793196dec9 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 23 May 2023 01:37:22 +0200 Subject: Fix Performance/RedundantBlockCall offense Ref: https://github.com/fastruby/fast-ruby#proccall-and-block-arguments-vs-yieldcode --- .rubocop_todo.yml | 5 ----- lib/axlsx/util/zip_command.rb | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1de00edb..a6f0c9af 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -88,11 +88,6 @@ Performance/CollectionLiteralInLoop: - 'lib/axlsx/package.rb' - 'lib/axlsx/workbook/worksheet/page_margins.rb' -# This cop supports safe autocorrection (--autocorrect). -Performance/RedundantBlockCall: - Exclude: - - 'lib/axlsx/util/zip_command.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: separated, grouped diff --git a/lib/axlsx/util/zip_command.rb b/lib/axlsx/util/zip_command.rb index bc098a92..44e06af5 100644 --- a/lib/axlsx/util/zip_command.rb +++ b/lib/axlsx/util/zip_command.rb @@ -25,10 +25,10 @@ module Axlsx # Create a temporary directory for writing files to. # # The directory and its contents are removed at the end of the block. - def open(output, &block) + def open(output) Dir.mktmpdir do |dir| @dir = dir - block.call(self) + yield(self) write_file zip_parts(output) end -- cgit v1.2.3