class Gem::Molinillo::Resolver::Resolution::UnwindDetails

公共实例方法

<=>(other) 点击切换源代码

我们在选择要回溯到的状态时比较 UnwindDetails 。 如果两个选项具有相同的 state_index,我们更喜欢最远离导致冲突的需求的选项。 两个选项都会回溯到相同的状态,但是“祖父”选项在执行此操作后会过滤掉较少的可能性 - 如果一个状态既是导致冲突的需求的“父级”又是“祖父级”,这是正确的行为。 @param [UnwindDetail] other 要比较的 UnwindDetail @return [Integer] 指定顺序的整数

# File rubygems/vendor/molinillo/lib/molinillo/resolution.rb, line 83
def <=>(other)
  if state_index > other.state_index
    1
  elsif state_index == other.state_index
    reversed_requirement_tree_index <=> other.reversed_requirement_tree_index
  else
    -1
  end
end
all_requirements() 点击切换源代码

@return [Array] 导致需要的所有需求的数组

this unwind
# File rubygems/vendor/molinillo/lib/molinillo/resolution.rb, line 126
def all_requirements
  @all_requirements ||= requirement_trees.flatten(1)
end
reversed_requirement_tree_index() 点击切换源代码

@return [Integer] 反向需求树中状态需求的索引

(the conflicting requirement itself will be at position 0)
# File rubygems/vendor/molinillo/lib/molinillo/resolution.rb, line 95
def reversed_requirement_tree_index
  @reversed_requirement_tree_index ||=
    if state_requirement
      requirement_tree.reverse.index(state_requirement)
    else
      999_999
    end
end
sub_dependencies_to_avoid() 点击切换源代码

@return [Array] 选择时要避免的子依赖项的数组

new possibility for the state we've unwound to. Only relevant for
non-primary unwinds
# File rubygems/vendor/molinillo/lib/molinillo/resolution.rb, line 116
def sub_dependencies_to_avoid
  @requirements_to_avoid ||=
    requirement_trees.map do |tree|
      index = tree.index(state_requirement)
      tree[index + 1] if index
    end.compact
end
unwinding_to_primary_requirement?() 点击切换源代码

@return [Boolean] 我们要回溯的状态的需求位置

to directly caused the conflict. Note: in this case, it is
impossible for the state we're unwinding to be a parent of
any of the other conflicting requirements (or we would have
circularity)
# File rubygems/vendor/molinillo/lib/molinillo/resolution.rb, line 109
def unwinding_to_primary_requirement?
  requirement_tree.last == state_requirement
end