class Bundler::Resolver::Candidate

此类是与 PubGrub 兼容的 “Version” 类,它考虑了 Bundler 解析的复杂性。

每个 Resolver::Candidate 都有一个底层的 'Gem::Version` 以及一组平台。例如,1.1.0-x86_64-linux 与 1.1.0(通用)是不同的解析候选项。这是因为同一 gem 版本的不同平台变体可能会带来不同的依赖关系,因此需要单独考虑。

一些候选项还可能明确保留关于它们所指的包的一些信息。这些候选项被称为“规范的”,并在将解析结果实例化回可以安装、写入锁定文件等的 RubyGems 规范时使用。

属性

version[R]

公共类方法

new(version, group: nil, priority: -1) 点击切换源码
# File bundler/resolver/candidate.rb, line 27
def initialize(version, group: nil, priority: -1)
  @spec_group = group || SpecGroup.new([])
  @version = Gem::Version.new(version)
  @priority = priority
end

公共实例方法

<=>(other) 点击切换源码
# File bundler/resolver/candidate.rb, line 55
def <=>(other)
  return unless other.is_a?(self.class)

  sort_obj <=> other.sort_obj
end
==(other) 点击切换源码
# File bundler/resolver/candidate.rb, line 61
def ==(other)
  return unless other.is_a?(self.class)

  sort_obj == other.sort_obj
end
dependencies() 点击切换源码
# File bundler/resolver/candidate.rb, line 33
def dependencies
  @spec_group.dependencies
end
eql?(other) 点击切换源码
# File bundler/resolver/candidate.rb, line 67
def eql?(other)
  return unless other.is_a?(self.class)

  sort_obj.eql?(other.sort_obj)
end
hash() 点击切换源码
# File bundler/resolver/candidate.rb, line 73
def hash
  sort_obj.hash
end
prerelease?() 点击切换源码
# File bundler/resolver/candidate.rb, line 43
def prerelease?
  @version.prerelease?
end
segments() 点击切换源码
# File bundler/resolver/candidate.rb, line 47
def segments
  @version.segments
end
sort_obj() 点击切换源码
# File bundler/resolver/candidate.rb, line 51
def sort_obj
  [@version, @priority]
end
to_s() 点击切换源码
# File bundler/resolver/candidate.rb, line 77
def to_s
  @version.to_s
end
to_specs(package, most_specific_locked_platform) 点击切换源码
# File bundler/resolver/candidate.rb, line 37
def to_specs(package, most_specific_locked_platform)
  return [] if package.meta?

  @spec_group.to_specs(package.force_ruby_platform?, most_specific_locked_platform)
end