Class: Gem::Molinillo::Resolver::Resolution::UnwindDetails
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Struct
|
|
Instance Chain:
self,
Comparable,
Struct
|
|
Inherits: |
Struct
|
Defined in: | lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb, lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb |
Overview
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
Instance Attribute Summary
-
#conflicting_requirements
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
-
#requirement_tree
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
-
#requirement_trees
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
-
#requirements_unwound_to_instead
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
-
#state_index
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
-
#state_requirement
rw
Details of the state to unwind to when a conflict occurs, and the cause of the unwind.
- #unwinding_to_primary_requirement? ⇒ Boolean readonly
Instance Method Summary
-
#<=>(other) ⇒ Integer
We compare
UnwindDetails
when choosing which state to unwind to. - #all_requirements ⇒ Array
- #reversed_requirement_tree_index ⇒ Integer
- #sub_dependencies_to_avoid ⇒ Array
Instance Attribute Details
#conflicting_requirements (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#requirement_tree (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#requirement_trees (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#requirements_unwound_to_instead (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#state_index (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#state_requirement (rw)
Details of the state to unwind to when a conflict occurs, and the cause of the unwind
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 62
UnwindDetails = Struct.new( :state_index, :state_requirement, :requirement_tree, :conflicting_requirements, :requirement_trees, :requirements_unwound_to_instead )
#unwinding_to_primary_requirement? ⇒ Boolean
(readonly)
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 109
def unwinding_to_primary_requirement? requirement_tree.last == state_requirement end
Instance Method Details
#<=>(other) ⇒ Integer
We compare UnwindDetails
when choosing which state to unwind to. If two options have the same state_index we prefer the one most removed from a requirement that caused the conflict. Both options would unwind to the same state, but a grandparent
option will filter out fewer of its possibilities after doing so - where a state is both a parent
and a grandparent
to requirements that have caused a conflict this is the correct behaviour.
# File 'lib/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 ⇒ Array
# File 'lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb', line 126
def all_requirements @all_requirements ||= requirement_trees.flatten(1) end
#reversed_requirement_tree_index ⇒ Integer
# File 'lib/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 ⇒ Array
# File 'lib/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