Skip to content

Commit

Permalink
[rubygems/rubygems] Fix method redefinition warning in gem exec specs
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins authored and matzbot committed Feb 28, 2023
1 parent cf18f0b commit 2d6097a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rubygems/commands/exec_command.rb
Expand Up @@ -235,11 +235,13 @@ def suppress_always_install
name = :always_install
cls = ::Gem::Resolver::InstallerSet
method = cls.instance_method(name)
cls.remove_method(name)
cls.define_method(name) { [] }

begin
yield
ensure
cls.remove_method(name)
cls.define_method(name, method)
end
end
Expand Down

0 comments on commit 2d6097a

Please sign in to comment.