Repository navigation
Require Ruby 2.7.3 and replace ruby2_keywords - #2499
Merged
Merged
Conversation
Rack::Multipart::UploadedFile forwards missing methods to the wrapped tempfile, but the delegator was never flagged with ruby2_keywords. On Ruby 3.0+, where keywords are separated from a trailing Hash, the keywords are rebuilt as a positional Hash before reaching the tempfile: uploaded_file.readlines(chomp: true) # => TypeError: no implicit conversion of Hash into Integer uploaded_file.gets(chomp: true) # => TypeError: no implicit conversion of Hash into Integer Ruby 2.4 through 2.6 are unaffected, since they do not distinguish a trailing Hash from keywords, which is why this went unnoticed. Flag the delegator, matching BodyProxy#method_missing and MockResponse::Cookie#method_missing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Use argument forwarding for middleware and delegators instead of ruby2_keywords. Remove obsolete compatibility branches and test only supported Ruby versions. Assisted-By: devx/9a5ced6c-36f2-46e3-a662-1765c7341b0e
samuel-williams-shopify
force-pushed
the
drop-ruby2-keywords
branch
from
August 13, 2026 22:15
5d9efdf to
cb7852f
Compare
jeremyevans
requested changes
Aug 13, 2026
Contributor
|
Note that Matz agreed to the deprecation (4.2) and removal (4.4) of |
Keep the latest Ruby 2.7 release line by using the leading-argument forwarding syntax available since Ruby 2.7.3. Test both the minimum version and the latest 2.7 patch release. Assisted-By: devx/4adb4993-e502-416b-8fe7-efc94c16ae7e
jeremyevans
approved these changes
Aug 14, 2026
This was referenced Aug 14, 2026
Contributor
Indeed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ruby Feature #22205 records agreement to deprecate
ruby2_keywords, with warnings beginning in Ruby 4.2 and removal in Ruby 4.4. Therefore, we should remove our usage ofruby2_keywords, otherwise Rack 3.3 (tentatively) would break on Ruby 4.4. As it stands, all released versions of Rack will break on Ruby 4.4.ruby2_keywordswith...argument forwarding inRack::Builderand Rack's delegatorsWhy Ruby 2.7.3?
Ruby 2.7 introduced
...argument forwarding. Support for leading arguments such asdef method_missing(name, ...), which Rack needs, was backported in Ruby 2.7.3. Ruby 2.7.0 through 2.7.2 therefore cannot parse all of the forwarding definitions used here.Using 2.7.3 as the minimum preserves compatibility with the final Ruby 2.7 release line while allowing Rack to remove every
ruby2_keywordscall without version-gated forwarding implementations. CI includes both exact Ruby 2.7.3 and2.7, which resolves to the latest patch release.A Ruby 3.0 minimum would provide a cleaner keyword-separation boundary, but is not technically required when
...is used. The trade-off is retaining support for Ruby 2.7's transitional keyword semantics; the forwarding sites in this PR avoid that ambiguity by forwarding the original arguments unchanged.Rack::Headers#exceptremains conditional using feature detection because Ruby before 3.0 does not provideHash#except.Related work
This is stacked on #2482 so
Rack::Multipart::UploadedFileis migrated directly to...instead of introducing anotherruby2_keywordsdependency. The original commit and authorship from @SeanLF are preserved; if #2482 merges first, that commit will drop out of this PR.This takes the minimum-version approach discussed in #2484 instead of retaining older Ruby support through version-gated method definitions.
Verification
bundle exec rakeRack::Builder,Rack::BodyProxy,Rack::MockResponse::Cookie, andRack::Multipart::UploadedFilerequired_ruby_version