Skip to content

Commit

Permalink
[rubygems/rubygems] Deprecate Gem::Platform.match
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt authored and matzbot committed Jul 21, 2023
1 parent f602cb5 commit 7fdf98e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/rubygems/platform.rb
Expand Up @@ -22,6 +22,11 @@ def self.match(platform)
match_platforms?(platform, Gem.platforms)
end

class << self
extend Gem::Deprecate
rubygems_deprecate :match, "Gem::Platform.match_spec? or match_gem?"
end

def self.match_platforms?(platform, platforms)
platform = Gem::Platform.new(platform) unless platform.is_a?(Gem::Platform)
platforms.any? do |local_platform|
Expand Down
6 changes: 4 additions & 2 deletions test/rubygems/test_gem_platform.rb
Expand Up @@ -483,8 +483,10 @@ def test_inspect
def test_gem_platform_match_with_string_argument
util_set_arch "x86_64-linux-musl"

assert(Gem::Platform.match(Gem::Platform.new("x86_64-linux")), "should match Gem::Platform")
assert(Gem::Platform.match("x86_64-linux"), "should match String platform")
Gem::Deprecate.skip_during do
assert(Gem::Platform.match(Gem::Platform.new("x86_64-linux")), "should match Gem::Platform")
assert(Gem::Platform.match("x86_64-linux"), "should match String platform")
end
end

def assert_local_match(name)
Expand Down

0 comments on commit 7fdf98e

Please sign in to comment.