Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use import_methods instead of include in refinements if available. #3674

Merged
merged 1 commit into from
Oct 28, 2021

Conversation

casperisfine
Copy link
Contributor

Ruby 3.1 deprecate the use of include/prepend inside refinements

Ref: https://bugs.ruby-lang.org/issues/17429

Copy link
Owner

@rmosolgo rmosolgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update here. Interesting change in Ruby.

TYPE_CLASSES.each do |type_class|
refine type_class.singleton_class do
include Methods
if Refinement.private_method_defined?(:import_methods)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if Refinement.private_method_defined?(:import_methods)
if defined?(::Refinement) && Refinement.private_method_defined?(:import_methods)

It looks like Refinement was added in the patch you linked earlier: ruby/ruby@6606597#diff-ddea6b44375166521cc45b79d4c54b08594c13872acc5ec279f07d2eda8c32baR684 Judging by CI failures, I guess we should check if it exists first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed 🤦

Ruby 3.1 deprecate the use of include/prepend inside refienements
Ref: https://bugs.ruby-lang.org/issues/17429
@casperisfine casperisfine force-pushed the ruby-3.1-refinement-include branch from 8625f01 to ddce9dc Compare October 28, 2021 13:45
@rmosolgo rmosolgo merged commit 4ae082f into rmosolgo:master Oct 28, 2021
@rmosolgo rmosolgo added this to the 1.12.18 milestone Oct 28, 2021
@rmosolgo
Copy link
Owner

Thanks for the fix!

dipth added a commit to dipth/graphql-batch that referenced this pull request Feb 14, 2023
to add support for Ruby 3.2 related to the use of include in refinements as fixed in this PR:
rmosolgo/graphql-ruby#3674
a-lavis added a commit to kickstarter/graphql-ruby that referenced this pull request Aug 25, 2023
a-lavis added a commit to kickstarter/graphql-ruby that referenced this pull request Jan 22, 2024
a-lavis added a commit to kickstarter/graphql-ruby that referenced this pull request Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants