Use ruby2_keywords for delegation#1750
Merged
jkowens merged 1 commit intosinatra:masterfrom Feb 21, 2022
Merged
Conversation
Follows the "The Only Correct Way" from https://eregon.me/blog/2021/02/13/correct-delegation-in-ruby-2-27-3.html Related to sinatra#1670 Fixes sinatra#1749
|
My minimal reproduction from #1670 passes with this patch "applied", and a Logstash that has had its plugin manager invoked resulting in Sinatra 2.2.0 being installed and run via jruby is also fixed by applying this patch: diff --git a/vendor/bundle/jruby/2.5.0/gems/sinatra-2.2.0/lib/sinatra/base.rb b/vendor/bundle/jruby/2.5.0/gems/sinatra-2.2.0/lib/sinatra/base.rb
index 6ced0a6..986fe45 100644
--- a/vendor/bundle/jruby/2.5.0/gems/sinatra-2.2.0/lib/sinatra/base.rb
+++ b/vendor/bundle/jruby/2.5.0/gems/sinatra-2.2.0/lib/sinatra/base.rb
@@ -1533,10 +1533,11 @@ module Sinatra
# Create a new instance of the class fronted by its middleware
# pipeline. The object is guaranteed to respond to #call but may not be
# an instance of the class new was called on.
- def new(*args, **kwargs, &bk)
- instance = new!(*args, **kwargs, &bk)
+ def new(*args, &bk)
+ instance = new!(*args, &bk)
Wrapper.new(build(instance).to_app, instance)
end
+ ruby2_keywords :new if respond_to?(:ruby2_keywords, true)
# Creates a Rack::Builder instance with all the middleware set up and
# the given +app+ as end point. |
This was referenced Feb 17, 2022
logstash 7.16.* recently fails to start when using this plugin!
cherweg/logstash-input-s3-sns-sqs#70
Open
epergo
approved these changes
Feb 21, 2022
Contributor
|
Hey @jkowens any chance to push 2.2.1 to unbreak JRuby users (accidentally) installing latest sinatra? |
Member
|
We'll have to check with @namusyaka to see about cutting a 2.2.1 release. |
This was referenced Aug 17, 2022
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.
Follows "The Only Correct Way" from https://eregon.me/blog/2021/02/13/correct-delegation-in-ruby-2-27-3.html
Related to #1670
Fixes #1749