diff options
author | Daniel Niknam <[email protected]> | 2021-08-19 21:57:57 +1000 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2021-08-31 19:06:14 +0900 |
commit | f212b9d4f2eb7f94359778d0ec5f3e38f2d90461 (patch) | |
tree | b9e44feb51d51719acff2479226eb358a693aa5a /lib/rubygems/platform.rb | |
parent | c71d1a26efc26309e877cd2babfec345514833cf (diff) |
[rubygems/rubygems] Refactor Ruby platform priority condition to its own method
The `Gem::Platform::RUBY ? -1 : 1` has been used multiple times in different places and could be refactored to a method (DRY).
https://github.com/rubygems/rubygems/commit/9d43ca8f0c
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4789
Diffstat (limited to 'lib/rubygems/platform.rb')
-rw-r--r-- | lib/rubygems/platform.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 9750df181b..4b8ac31847 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -40,6 +40,10 @@ class Gem::Platform match_platforms?(platform, Gem.platforms) end + def self.sort_priority(platform) + platform == Gem::Platform::RUBY ? -1 : 1 + end + def self.installable?(spec) if spec.respond_to? :installable_platform? spec.installable_platform? |