summaryrefslogtreecommitdiffhomepage
path: root/test/support/capture_warnings.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-03 18:56:24 +0200
committerGeremia Taglialatela <[email protected]>2023-05-03 18:56:24 +0200
commit76647606589f1f5d370a1b0add2b1b8e52dc82ea (patch)
treee7cc041098b4a4fbd6d9e4e20bbd90c21308e95b /test/support/capture_warnings.rb
parentaaf88bd98054b1823ba0ade4b883b84e41b5e947 (diff)
downloadcaxlsx-76647606589f1f5d370a1b0add2b1b8e52dc82ea.tar.gz
caxlsx-76647606589f1f5d370a1b0add2b1b8e52dc82ea.zip
Introduce RuboCop performance
Also fixes performance offences in non-production code
Diffstat (limited to 'test/support/capture_warnings.rb')
-rw-r--r--test/support/capture_warnings.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/support/capture_warnings.rb b/test/support/capture_warnings.rb
index 60d4f24d..c327a145 100644
--- a/test/support/capture_warnings.rb
+++ b/test/support/capture_warnings.rb
@@ -1,5 +1,5 @@
module CaptureWarnings
- def capture_warnings(&block)
+ def capture_warnings
# Turn off warnings with setting $VERBOSE to nil
original_verbose = $VERBOSE
$VERBOSE = nil
@@ -8,7 +8,7 @@ module CaptureWarnings
original_warn = Kernel.instance_method(:warn)
warnings = []
Kernel.send(:define_method, :warn) { |string| warnings << string }
- block.call
+ yield
# Revert to the original warn method and set back $VERBOSE to previous value
Kernel.send(:define_method, :warn, original_warn)