diff options
author | Daniel Niknam <mhmd.niknam@gmail.com> | 2021-08-19 21:57:57 +1000 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-08-31 19:06:14 +0900 |
commit | f212b9d4f2eb7f94359778d0ec5f3e38f2d90461 (patch) | |
tree | b9e44feb51d51719acff2479226eb358a693aa5a /lib/rubygems/name_tuple.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/name_tuple.rb')
-rw-r--r-- | lib/rubygems/name_tuple.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb index 3d0afa3094..c732d7f968 100644 --- a/lib/rubygems/name_tuple.rb +++ b/lib/rubygems/name_tuple.rb @@ -89,9 +89,8 @@ class Gem::NameTuple alias to_s inspect # :nodoc: def <=>(other) - [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] <=> - [other.name, other.version, - other.platform == Gem::Platform::RUBY ? -1 : 1] + [@name, @version, Gem::Platform.sort_priority(@platform)] <=> + [other.name, other.version, Gem::Platform.sort_priority(other.platform)] end include Comparable |