Spec-Zone.ru › Ruby 2.7

class Bundler::Molinillo::Resolver::Resolution::UnwindDetails

Parent:
Object
Included modules:
Comparable

Публичные методы экземпляров

<=>(other) Показать исходный код
# File lib/bundler/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

Мы сравниваем UnwindDetails при выборе состояния, к которому нужно выполнить разматывание. Если у двух вариантов одинаковый индекс состояния, мы отдаём предпочтение тому, который наиболее удалён от требования, вызвавшего конфликт. Оба варианта будут разматывать до одного и того же состояния, но вариант `grandparent` отфильтрует меньше возможностей после этого — где состояние является как `parent`, так и `grandparent` к требованиям, вызвавшим конфликт, это правильное поведение. @param [UnwindDetail] other UnwindDetail для сравнения @return [Integer] целое число, определяющее порядок

all_requirements() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb, line 126
def all_requirements
  @all_requirements ||= requirement_trees.flatten(1)
end

@return [Array] массив всех требований, которые привели к необходимости

this unwind
reversed_requirement_tree_index() Показать исходный код
# File lib/bundler/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

@return [Integer] индекс требования состояния в обратном дереве требований

(the conflicting requirement itself will be at position 0)
sub_dependencies_to_avoid() Показать исходный код
# File lib/bundler/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

@return [Array] массив подзависимостей, которых следует избегать при выборе

new possibility for the state we've unwound to. Only relevant for
non-primary unwinds
unwinding_to_primary_requirement?() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb, line 109
def unwinding_to_primary_requirement?
  requirement_tree.last == state_requirement
end

@return [Boolean] где требование состояния, которое мы разматываем

to directly caused the conflict. Note: in this case, it is
impossible for the state we're unwinding to to be a parent of
any of the other conflicting requirements (or we would have
circularity)

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API