diff --git a/benchmarks/benchmarks.rb b/benchmarks/benchmarks.rb index 073b21b6..37518223 100644 --- a/benchmarks/benchmarks.rb +++ b/benchmarks/benchmarks.rb @@ -82,7 +82,7 @@ def benchmark_name # Use metaprogramming to ensure that each class is created in exactly the # the same way. -BENCHMARK_GEMS.each do |benchmark_gem| +BENCHMARK_GEMS.each do |benchmark_gem| # rubocop:disable Metrics/BlockLength eval <<~HEREDOC, binding, __FILE__, __LINE__ + 1 # rubocop:disable Security/Eval class #{benchmark_gem.klass}Example #{benchmark_gem.activation_code} diff --git a/lib/memo_wise.rb b/lib/memo_wise.rb index db5d76a6..47248b8d 100644 --- a/lib/memo_wise.rb +++ b/lib/memo_wise.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -# Disable RuboCop here because Ruby < 3.2 does not load `set` by default. -require "set" # rubocop:disable Lint/RedundantRequireStatement +require "set" # Ruby < 3.2 does not load `set` by default. require "memo_wise/internal_api" require "memo_wise/version" diff --git a/spec/dokaz_helpers.rb b/spec/dokaz_helpers.rb index 67ad7e44..76f36e74 100644 --- a/spec/dokaz_helpers.rb +++ b/spec/dokaz_helpers.rb @@ -5,6 +5,6 @@ require "memo_wise" # Enable the example RSpec `after` call in README.md to execute successfully -def after(scope, &) +def after(scope, &block) # Do nothing end diff --git a/spec/memo_wise_spec.rb b/spec/memo_wise_spec.rb index 2a3f4b90..e9f6ded2 100644 --- a/spec/memo_wise_spec.rb +++ b/spec/memo_wise_spec.rb @@ -134,11 +134,11 @@ expect(target.proc_method_counter).to eq(1) end - it "will not memoize methods with implicit block arguments" do + it "does not memoize methods with implicit block arguments" do expect { target.implicit_block_method }.to raise_error(LocalJumpError) end - it "will not memoize methods with explicit block arguments" do + it "does not memoize methods with explicit block arguments" do expect { target.explicit_block_method { nil } }.to raise_error(LocalJumpError) end end @@ -153,7 +153,7 @@ # Now confirm our non-memoized method is not memoized. expect(Array.new(4) { non_memoized.no_args }).to all eq("#{non_memoized_name}_no_args") - expect(non_memoized.send("#{non_memoized_name}_no_args_counter")).to eq(4) + expect(non_memoized.send(:"#{non_memoized_name}_no_args_counter")).to eq(4) end end @@ -167,7 +167,7 @@ expect(Array.new(4) { non_memoized.with_one_positional_arg(1) }). to all eq("#{non_memoized_name}_with_one_positional_arg: a=1") - expect(non_memoized.send("#{non_memoized_name}_one_positional_arg_counter")).to eq(4) + expect(non_memoized.send(:"#{non_memoized_name}_one_positional_arg_counter")).to eq(4) end end @@ -181,7 +181,7 @@ expect(Array.new(4) { non_memoized.with_positional_args(1, 2) }). to all eq("#{non_memoized_name}_with_positional_args: a=1, b=2") - expect(non_memoized.send("#{non_memoized_name}_positional_args_counter")).to eq(4) + expect(non_memoized.send(:"#{non_memoized_name}_positional_args_counter")).to eq(4) end end end @@ -884,8 +884,8 @@ def no_args_counter end it "doesn't define #inherited" do - expect(klass).to be_respond_to(:inherited) - expect(klass.new).to_not be_respond_to(:inherited) + expect(klass).to respond_to(:inherited) + expect(klass.new).to_not respond_to(:inherited) end end @@ -921,8 +921,8 @@ def no_args_counter end it "doesn't define #inherited" do - expect(klass).to be_respond_to(:inherited) - expect(klass.new).to_not be_respond_to(:inherited) + expect(klass).to respond_to(:inherited) + expect(klass.new).to_not respond_to(:inherited) end end @@ -960,8 +960,8 @@ def no_args_counter end it "doesn't define #inherited" do - expect(klass).to be_respond_to(:inherited) - expect(klass.new).to_not be_respond_to(:inherited) + expect(klass).to respond_to(:inherited) + expect(klass.new).to_not respond_to(:inherited) end end end diff --git a/spec/support/define_methods_for_testing_memo_wise.rb b/spec/support/define_methods_for_testing_memo_wise.rb index 9da9c1ea..0e3d6560 100644 --- a/spec/support/define_methods_for_testing_memo_wise.rb +++ b/spec/support/define_methods_for_testing_memo_wise.rb @@ -26,7 +26,7 @@ def self.define_methods_for_testing_memo_wise(target:, via:) # :nocov: raise ArgumentError, "Not a Class or Module: #{target.inspect}" unless target.is_a?(Module) - raise ArgumentError, "Unknown value for 'via': #{via}" unless %i[instance self_dot].include?(via) # rubocop:disable Layout/EmptyLineAfterGuardClause + raise ArgumentError, "Unknown value for 'via': #{via}" unless %i[instance self_dot].include?(via) # :nocov: self_prefix = via == :self_dot ? "self." : ""