diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 206a69d..1c690b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: matrix: # Due to https://github.com/actions/runner/issues/849, we have to use # quotes for '3.0' -- without quotes, CI sees '3' and runs the latest. - ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby, truffleruby-head] + ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, jruby, truffleruby-head] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -24,7 +24,7 @@ jobs: - name: Set bundler environment variables run: | echo "BUNDLE_WITH=checks:docs" >> $GITHUB_ENV - if: matrix.ruby == 3.2 + if: matrix.ruby == 3.3 # Use 'bundler-cache: true' instead of actions/cache as advised: # * https://github.com/actions/cache/blob/main/examples.md#ruby---bundler @@ -41,18 +41,18 @@ jobs: fail_ci_if_error: true # optional (default = false) token: ${{ secrets.CODECOV_TOKEN }} verbose: true # optional (default = false) - if: matrix.ruby == 3.2 + if: matrix.ruby == 3.3 - run: bundle exec rubocop - if: matrix.ruby == 3.2 + if: matrix.ruby == 3.3 - run: | bundle exec yard doctest bundle exec dokaz - if: matrix.ruby == 3.2 + if: matrix.ruby == 3.3 - - name: Run benchmarks on Ruby 2.7 or 3.2 + - name: Run benchmarks on Ruby 2.7 or 3.3 run: | BUNDLE_GEMFILE=benchmarks/Gemfile bundle install --jobs 4 --retry 3 BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb - if: matrix.ruby == '2.7' || matrix.ruby == '3.2' + if: matrix.ruby == '2.7' || matrix.ruby == '3.3' diff --git a/.ruby-version b/.ruby-version index be94e6f..4772543 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.2 diff --git a/Gemfile.lock b/Gemfile.lock index d1d00d9..1ec9370 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ GIT remote: https://github.com/panorama-ed/panolint-ruby.git - revision: a93988ea554177cf0ec9ef636c442f9d3af49a10 + revision: f3fde1ecdaec4090c200346b4aa8c35c0ad13135 branch: main specs: panolint-ruby (0) - rubocop (= 1.51.0) - rubocop-performance (= 1.18.0) - rubocop-rspec (= 2.22.0) + rubocop (= 1.64.1) + rubocop-performance (= 1.20.2) + rubocop-rspec (= 2.29.2) PATH remote: . @@ -24,16 +24,20 @@ GEM ansi rouge (~> 4) slop (~> 3) - json (2.6.3) + json (2.7.2) + language_server-protocol (3.17.0.3) minitest (5.18.0) - parallel (1.23.0) - parser (3.2.2.1) + parallel (1.24.0) + parser (3.3.2.0) ast (~> 2.4.1) + racc + racc (1.8.0) rainbow (3.1.1) rake (13.1.0) redcarpet (3.6.0) - regexp_parser (2.8.0) - rexml (3.2.5) + regexp_parser (2.9.2) + rexml (3.2.8) + strscan (>= 3.0.9) rouge (4.1.0) rspec (3.13.0) rspec-core (~> 3.13.0) @@ -48,29 +52,33 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) - rubocop (1.51.0) + rubocop (1.64.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.1) - parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) - rubocop (~> 1.33) - rubocop-performance (1.18.0) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rspec (2.22.0) - rubocop (~> 1.33) + rubocop-factory_bot (2.25.1) + rubocop (~> 1.41) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rspec (2.29.2) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.28.3) + rubocop (~> 1.40) ruby-progressbar (1.13.0) simplecov (0.22.0) docile (~> 1.1) @@ -82,7 +90,8 @@ GEM simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) slop (3.6.0) - unicode-display_width (2.4.2) + strscan (3.1.0) + unicode-display_width (2.5.0) values (1.8.0) webrick (1.8.1) yard (0.9.36) diff --git a/lib/memo_wise.rb b/lib/memo_wise.rb index dace3d6..30d4cf9 100644 --- a/lib/memo_wise.rb +++ b/lib/memo_wise.rb @@ -1,7 +1,7 @@ # 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" require "memo_wise/internal_api" require "memo_wise/version" @@ -31,12 +31,12 @@ module MemoWise # [calling the original](https://medium.com/@jeremy_96642/ruby-method-auditing-using-module-prepend-4f4e69aacd95) # constructor. # - # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.2.2/Module.html#method-i-prepend) + # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.3.1/Module.html#method-i-prepend) # important here # ([more info](https://medium.com/@leo_hetsch/ruby-modules-include-vs-prepend-vs-extend-f09837a5b073))? # - **A:** To set up *mutable state* inside the instance, even if the original # constructor will then call - # [Object#freeze](https://ruby-doc.org/3.2.2/Object.html#method-i-freeze). + # [Object#freeze](https://ruby-doc.org/3.3.1/Object.html#method-i-freeze). # # This approach supports memoization on frozen (immutable) objects -- for # example, classes created by the @@ -101,7 +101,7 @@ def inherited(subclass) # @param target [Class] # The `Class` into to prepend the MemoWise methods e.g. `memo_wise` # - # @see https://ruby-doc.org/3.2.2/Module.html#method-i-prepend + # @see https://ruby-doc.org/3.3.1/Module.html#method-i-prepend # # @example # class Example @@ -116,7 +116,7 @@ class << target # # This is necessary in addition to the `#initialize` method definition # above because - # [`Class#allocate`](https://ruby-doc.org/3.2.2/Class.html#method-i-allocate) + # [`Class#allocate`](https://ruby-doc.org/3.3.1/Class.html#method-i-allocate) # bypasses `#initialize`, and when it's used (e.g., # [in ActiveRecord](https://github.com/rails/rails/blob/a395c3a6af1e079740e7a28994d77c8baadd2a9d/activerecord/lib/active_record/persistence.rb#L411)) # we still need to be able to access MemoWise's instance variable. Despite @@ -268,7 +268,7 @@ def #{method_name}(#{MemoWise::InternalAPI.args_str(method)}) ) end - # Override [Module#instance_method](https://ruby-doc.org/3.2.2/Module.html#method-i-instance_method) + # Override [Module#instance_method](https://ruby-doc.org/3.3.1/Module.html#method-i-instance_method) # to proxy the original `UnboundMethod#parameters` results. We want the # parameters to reflect the original method in order to support callers # who want to use Ruby reflection to process the method parameters,