summaryrefslogtreecommitdiff
path: root/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb')
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
index c3a1d5a2ef..deb4659448 100644
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
+++ b/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'set'
require 'tsort'
@@ -15,8 +15,10 @@ module Gem::Resolver::Molinillo
include TSort
+ # @visibility private
alias_method :tsort_each_node, :each
+ # @visibility private
def tsort_each_child(vertex, &block)
vertex.successors.each(&block)
end
@@ -42,12 +44,14 @@ module Gem::Resolver::Molinillo
# by {Vertex#name}
attr_reader :vertices
+ # Initializes an empty dependency graph
def initialize
@vertices = {}
end
# Initializes a copy of a {DependencyGraph}, ensuring that all {#vertices}
# are properly copied.
+ # @param [DependencyGraph] other the graph to copy.
def initialize_copy(other)
super
@vertices = {}
@@ -101,6 +105,7 @@ module Gem::Resolver::Molinillo
vertex
end
+ # Adds a vertex with the given name, or updates the existing one.
# @param [String] name
# @param [Object] payload
# @return [Vertex] the vertex that was added to `self`
@@ -151,6 +156,8 @@ module Gem::Resolver::Molinillo
private
+ # Adds a new {Edge} to the dependency graph without checking for
+ # circularity.
def add_edge_no_circular(origin, destination, requirement)
edge = Edge.new(origin, destination, requirement)
origin.outgoing_edges << edge
@@ -175,6 +182,7 @@ module Gem::Resolver::Molinillo
attr_accessor :root
alias_method :root?, :root
+ # Initializes a vertex with the given name and payload.
# @param [String] name see {#name}
# @param [Object] payload see {#payload}
def initialize(name, payload)
@@ -241,6 +249,7 @@ module Gem::Resolver::Molinillo
successors.to_set == other.successors.to_set
end
+ # @param [Vertex] other the other vertex to compare to
# @return [Boolean] whether the two vertices are equal, determined
# solely by {#name} and {#payload} equality
def shallow_eql?(other)