类 Gem::Platform

常量

JAVA
MINGW
MSWIN
MSWIN64
WINDOWS
X64_LINUX
X64_LINUX_MUSL
X64_MINGW

公共实例方法

===(other) 点击切换源码
# File bundler/rubygems_ext.rb, line 307
def ===(other)
  return nil unless Gem::Platform === other

  # universal-mingw32 matches x64-mingw-ucrt
  return true if (@cpu == "universal" || other.cpu == "universal") &&
                 @os.start_with?("mingw") && other.os.start_with?("mingw")

  # cpu
  ([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
  (@cpu == "arm" && other.cpu.start_with?("armv"))) &&

    # os
    @os == other.os &&

    # version
    (
      (@os != "linux" && (@version.nil? || other.version.nil?)) ||
      (@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
      @version == other.version
    )
end
normalized_linux_version_ext() 点击切换源码

这是 RubyGems 3.3.23 或更高版本 ‘normalized_linux_method’ 的副本。一旦仅支持 3.3.23,我们就可以使用 RubyGems 中的方法。

# File bundler/rubygems_ext.rb, line 331
def normalized_linux_version_ext
  return nil unless @version

  without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
  return nil if without_gnu_nor_abi_modifiers.empty?

  without_gnu_nor_abi_modifiers
end