Skip to content

Commit

Permalink
Use import_methods instead of include in refinements if available.
Browse files Browse the repository at this point in the history
Ruby 3.1 deprecate the use of include/prepend inside refienements
Ref: https://bugs.ruby-lang.org/issues/17429
  • Loading branch information
byroot committed Oct 28, 2021
1 parent 0613e0c commit ddce9dc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/graphql/deprecated_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@ def !
end
end

TYPE_CLASSES.each do |type_class|
refine type_class.singleton_class do
include Methods
if defined?(::Refinement) && Refinement.private_method_defined?(:import_methods)
TYPE_CLASSES.each do |type_class|
refine type_class.singleton_class do
import_methods Methods
end
end
else
TYPE_CLASSES.each do |type_class|
refine type_class.singleton_class do
include Methods
end
end
end
end
Expand Down

0 comments on commit ddce9dc

Please sign in to comment.