summaryrefslogtreecommitdiff
path: root/lib/bundler/rubygems_ext.rb
diff options
context:
space:
mode:
authorMartin Emde <martin.emde@gmail.com>2023-12-08 12:13:49 -0800
committergit <svn-admin@ruby-lang.org>2023-12-11 15:40:08 +0000
commite186cebe420367947b89a5221491429452d724d5 (patch)
tree00e7d5126d92066814780d828a53b428dafea7a0 /lib/bundler/rubygems_ext.rb
parentb673b5b4329d020b19907142f291c8ecd69e95e0 (diff)
[rubygems/rubygems] Override initialize in bundle rubygems_ext for NameTuple
https://github.com/rubygems/rubygems/commit/f63ce682d2
Diffstat (limited to 'lib/bundler/rubygems_ext.rb')
-rw-r--r--lib/bundler/rubygems_ext.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index c1daf3ced8..62a9426a72 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -352,11 +352,16 @@ module Gem
require "rubygems/name_tuple"
class NameTuple
- def self.new(name, version, platform="ruby")
- if Gem::Platform === platform
- super(name, version, platform.to_s)
- else
- super
+ # Versions of RubyGems before about 3.5.0 don't to_s the platform.
+ unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
+ alias_method :initialize_with_platform, :initialize
+
+ def initialize(name, version, platform=Gem::Platform::RUBY)
+ if Gem::Platform === platform
+ initialize_with_platform(name, version, platform.to_s)
+ else
+ initialize_with_platform(name, version, platform)
+ end
end
end