Class: Bundler::GemHelpers::PlatformMatch
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Struct
|
|
Instance Chain:
self,
Struct
|
|
Inherits: |
Struct
|
Defined in: | lib/bundler/gem_helpers.rb, lib/bundler/gem_helpers.rb |
Constant Summary
-
EXACT_MATCH =
# File 'lib/bundler/gem_helpers.rb', line 65new(-1, -1, -1).freeze
-
WORST_MATCH =
# File 'lib/bundler/gem_helpers.rb', line 66new(1_000_000, 1_000_000, 1_000_000).freeze
Class Method Summary
Instance Attribute Summary
- #cpu_match rw
- #os_match rw
- #platform_version_match rw
Instance Method Summary
Class Method Details
.cpu_match(spec_platform, user_platform)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 76
def self.cpu_match(spec_platform, user_platform) if spec_platform.cpu == user_platform.cpu 0 elsif spec_platform.cpu == "arm" && user_platform.cpu.to_s.start_with?("arm") 0 elsif spec_platform.cpu.nil? || spec_platform.cpu == "universal" 1 else 2 end end
.os_match(spec_platform, user_platform)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 68
def self.os_match(spec_platform, user_platform) if spec_platform.os == user_platform.os 0 else 1 end end
.platform_version_match(spec_platform, user_platform)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 88
def self.platform_version_match(spec_platform, user_platform) if spec_platform.version == user_platform.version 0 elsif spec_platform.version.nil? 1 else 2 end end
Instance Attribute Details
#cpu_match (rw)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 50
PlatformMatch = Struct.new(:os_match, :cpu_match, :platform_version_match)
#os_match (rw)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 50
PlatformMatch = Struct.new(:os_match, :cpu_match, :platform_version_match)
#platform_version_match (rw)
[ GitHub ]Instance Method Details
#<=>(other)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 52
def <=>(other) return nil unless other.is_a?(PlatformMatch) m = os_match <=> other.os_match return m unless m.zero? m = cpu_match <=> other.cpu_match return m unless m.zero? m = platform_version_match <=> other.platform_version_match m end