Class: Bundler::Molinillo::DependencyGraph::Vertex (Ruby 2.7.2)
Description: Class : Bundler::Molinillo::DependencyGraph::Vertex - Ruby 2.7.2

### Home Classes Methods

### In Files

- bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb

### Parent

Object

### Methods

- ::new
- #==
- #_path_to?
- #_recursive_predecessors
- #_recursive_successors
- #ancestor?
- #descendent?
- #eql?
- #hash
- #inspect
- #is_reachable_from?
- #path_to?
- #predecessors
- #recursive_predecessors
- #recursive_successors
- #requirements
- #shallow_eql?
- #successors

### Class/Module Index

Quicksearch

- AmbiguousCommandError
- AmbiguousTaskError
- Bundler
- Bundler::APIResponseMismatchError
- Bundler::BuildMetadata
- Bundler::BundlerError
- Bundler::CLI
- Bundler::CLI::Add
- Bundler::CLI::Binstubs
- Bundler::CLI::Cache
- Bundler::CLI::Check
- Bundler::CLI::Clean
- Bundler::CLI::Common
- Bundler::CLI::Config
- Bundler::CLI::Config::Base
- Bundler::CLI::Console
- Bundler::CLI::Doctor
- Bundler::CLI::Exec
- Bundler::CLI::Gem
- Bundler::CLI::Info
- Bundler::CLI::Init
- Bundler::CLI::Inject
- Bundler::CLI::Install
- Bundler::CLI::Issue
- Bundler::CLI::List
- Bundler::CLI::Lock
- Bundler::CLI::Open
- Bundler::CLI::Outdated
- Bundler::CLI::Package
- Bundler::CLI::Platform
- Bundler::CLI::Plugin
- Bundler::CLI::Pristine
- Bundler::CLI::Remove
- Bundler::CLI::Show
- Bundler::CLI::Update
- Bundler::CLI::Viz
- Bundler::CompactIndexClient
- Bundler::CompactIndexClient::Cache
- Bundler::CompactIndexClient::Error
- Bundler::CompactIndexClient::Updater
- Bundler::CompactIndexClient::Updater::MisMatchedChecksumError
- Bundler::ConnectionPool
- Bundler::ConnectionPool::Error
- Bundler::ConnectionPool::PoolShuttingDownError
- Bundler::ConnectionPool::Process
- Bundler::ConnectionPool::TimedStack
- Bundler::ConnectionPool::Wrapper
- Bundler::CurrentRuby
- Bundler::CyclicDependencyError
- Bundler::Definition
- Bundler::DepProxy
- Bundler::Dependency
- Bundler::Deployment
- Bundler::Deprecate
- Bundler::DeprecatedError
- Bundler::Dsl
- Bundler::Dsl::DSLError
- Bundler::EndpointSpecification
- Bundler::Env
- Bundler::EnvironmentPreserver
- Bundler::FeatureFlag
- Bundler::Fetcher
- Bundler::Fetcher::AuthenticationRequiredError
- Bundler::Fetcher::BadAuthenticationError
- Bundler::Fetcher::Base
- Bundler::Fetcher::CertificateFailureError
- Bundler::Fetcher::CompactIndex
- Bundler::Fetcher::Dependency
- Bundler::Fetcher::Downloader
- Bundler::Fetcher::FallbackError
- Bundler::Fetcher::Index
- Bundler::Fetcher::NetworkDownError
- Bundler::Fetcher::SSLError
- Bundler::Fetcher::TooManyRequestsError
- Bundler::FileUtils
- Bundler::FileUtils::DryRun
- Bundler::FileUtils::Entry_
- Bundler::FileUtils::Entry_::File
- Bundler::FileUtils::NoWrite
- Bundler::FileUtils::StreamUtils_
- Bundler::FileUtils::StreamUtils_::RbConfig
- Bundler::FileUtils::Verbose
- Bundler::FriendlyErrors
- Bundler::GemHelper
- Bundler::GemHelper::Rake
- Bundler::GemHelpers
- Bundler::GemHelpers::PlatformMatch
- Bundler::GemInstaller
- Bundler::GemNotFound
- Bundler::GemRemoteFetcher
- Bundler::GemRequireError
- Bundler::GemVersionPromoter
- Bundler::Gemdeps
- Bundler::GemfileError
- Bundler::GemfileEvalError
- Bundler::GemfileLockNotFound
- Bundler::GemfileNotFound
- Bundler::GemspecError
- Bundler::GenericSystemCallError
- Bundler::GitError
- Bundler::Graph
- Bundler::Graph::GraphVizClient
- Bundler::HTTPError
- Bundler::Index
- Bundler::Injector
- Bundler::InstallError
- Bundler::InstallHookError
- Bundler::Installer
- Bundler::InvalidOption
- Bundler::LazySpecification
- Bundler::LazySpecification::Identifier
- Bundler::LockfileError
- Bundler::LockfileGenerator
- Bundler::LockfileParser
- Bundler::MarshalError
- Bundler::MatchPlatform
- Bundler::MirrorSockets
- Bundler::Molinillo
- Bundler::Molinillo::CircularDependencyError
- Bundler::Molinillo::Compatibility
- Bundler::Molinillo::Delegates
- Bundler::Molinillo::Delegates::ResolutionState
- Bundler::Molinillo::Delegates::SpecificationProvider
- Bundler::Molinillo::DependencyGraph
- Bundler::Molinillo::DependencyGraph::Action
- Bundler::Molinillo::DependencyGraph::AddEdgeNoCircular
- Bundler::Molinillo::DependencyGraph::DeleteEdge
- Bundler::Molinillo::DependencyGraph::DetachVertexNamed
- Bundler::Molinillo::DependencyGraph::Log
- Bundler::Molinillo::DependencyGraph::Tag
- Bundler::Molinillo::DependencyGraph::Vertex
- Bundler::Molinillo::DependencyState
- Bundler::Molinillo::NoSuchDependencyError
- Bundler::Molinillo::PossibilityState
- Bundler::Molinillo::ResolutionState
- Bundler::Molinillo::Resolver
- Bundler::Molinillo::Resolver::Resolution
- Bundler::Molinillo::Resolver::Resolution::Conflict
- Bundler::Molinillo::Resolver::Resolution::PossibilitySet
- Bundler::Molinillo::Resolver::Resolution::UnwindDetails
- Bundler::Molinillo::ResolverError
- Bundler::Molinillo::SpecificationProvider
- Bundler::Molinillo::UI
- Bundler::Molinillo::VersionConflict
- Bundler::NoSpaceOnDeviceError
- Bundler::OperationNotSupportedError
- Bundler::ParallelInstaller
- Bundler::ParallelInstaller::SpecInstallation
- Bundler::PathError
- Bundler::PermissionError
- Bundler::Persistent
- Bundler::Persistent::Net
- Bundler::Persistent::Net::HTTP
- Bundler::Persistent::Net::HTTP::Persistent
- Bundler::Persistent::Net::HTTP::Persistent::Error
- Bundler::PersistentHTTP
- Bundler::Plugin
- Bundler::Plugin::API
- Bundler::Plugin::API::Source
- Bundler::Plugin::DSL
- Bundler::Plugin::DSL::PluginGemfileError
- Bundler::Plugin::Events
- Bundler::Plugin::Index
- Bundler::Plugin::Index::CommandConflict
- Bundler::Plugin::Index::SourceConflict
- Bundler::Plugin::Installer
- Bundler::Plugin::Installer::Git
- Bundler::Plugin::Installer::Rubygems
- Bundler::Plugin::MalformattedPlugin
- Bundler::Plugin::SourceList
- Bundler::Plugin::UndefinedCommandError
- Bundler::Plugin::UnknownSourceError
- Bundler::PluginError
- Bundler::ProcessLock
- Bundler::ProductionError
- Bundler::Psych
- Bundler::RemoteSpecification
- Bundler::Resolver
- Bundler::Resolver::SpecGroup
- Bundler::Retry
- Bundler::RubyDsl
- Bundler::RubyGemsGemInstaller
- Bundler::RubyVersion
- Bundler::RubyVersionMismatch
- Bundler::RubygemsIntegration
- Bundler::RubygemsIntegration::Gem
- Bundler::Runtime
- Bundler::SecurityError
- Bundler::Settings
- Bundler::Settings::Mirror
- Bundler::Settings::MirrorConfig
- Bundler::Settings::Mirrors
- Bundler::Settings::TCPSocketProbe
- Bundler::Settings::Validator
- Bundler::Settings::Validator::Rule
- Bundler::SharedHelpers
- Bundler::SimilarityDetector
- Bundler::SocketAddress
- Bundler::Source
- Bundler::Source::Gemspec
- Bundler::Source::Git
- Bundler::Source::Git::GitCommandError
- Bundler::Source::Git::GitNotAllowedError
- Bundler::Source::Git::GitNotInstalledError
- Bundler::Source::Git::GitProxy
- Bundler::Source::Git::MissingGitRevisionError
- Bundler::Source::Metadata
- Bundler::Source::Path
- Bundler::Source::Path::Installer
- Bundler::Source::Rubygems
- Bundler::Source::Rubygems::Remote
- Bundler::SourceList
- Bundler::SpecSet
- Bundler::Standalone
- Bundler::StubSpecification
- Bundler::SudoNotPermittedError
- Bundler::TemporaryResourceError
- Bundler::Thor::Actions
- Bundler::Thor::Actions::CapturableERB
- Bundler::Thor::Actions::ClassMethods
- Bundler::Thor::Base
- Bundler::Thor::Base::ClassMethods
- Bundler::Thor::Command
- Bundler::Thor::CoreExt
- Bundler::Thor::CoreExt::OrderedHash
- Bundler::Thor::DidYouMean
- Bundler::Thor::DynamicCommand
- Bundler::Thor::DynamicTask
- Bundler::Thor::Group
- Bundler::Thor::HiddenCommand
- Bundler::Thor::HiddenTask
- Bundler::Thor::Invocation
- Bundler::Thor::Invocation::ClassMethods
- Bundler::Thor::LineEditor
- Bundler::Thor::LineEditor::Basic
- Bundler::Thor::LineEditor::Readline
- Bundler::Thor::LineEditor::Readline::PathCompletion
- Bundler::Thor::NestedContext
- Bundler::Thor::RakeCompat
- Bundler::Thor::RakeCompat::Rake
- Bundler::Thor::Shell
- Bundler::Thor::Shell::Basic
- Bundler::Thor::Shell::Color
- Bundler::Thor::Shell::HTML
- Bundler::Thor::Task
- Bundler::Thor::Util
- Bundler::ThreadCreationError
- Bundler::UI
- Bundler::UI::RGProxy
- Bundler::UI::Shell
- Bundler::UI::Silent
- Bundler::URI
- Bundler::URI::BadURIError
- Bundler::URI::Error
- Bundler::URI::Escape
- Bundler::URI::FTP
- Bundler::URI::File
- Bundler::URI::Generic
- Bundler::URI::HTTP
- Bundler::URI::HTTPS
- Bundler::URI::InvalidComponentError
- Bundler::URI::InvalidURIError
- Bundler::URI::LDAP
- Bundler::URI::LDAPS
- Bundler::URI::MailTo
- Bundler::URI::REGEXP
- Bundler::URI::RFC2396_Parser
- Bundler::URI::RFC2396_REGEXP
- Bundler::URI::RFC2396_REGEXP::PATTERN
- Bundler::URICredentialsFilter
- Bundler::VersionConflict
- Bundler::VersionRanges
- Bundler::VersionRanges::ReqR
- Bundler::VirtualProtocolError
- Bundler::Worker
- Bundler::Worker::WrappedException
- Bundler::YAMLSerializer
- Bundler::YamlSyntaxError
- Capistrano
- DidYouMean
- Error
- Gem
- Gem::Dependency
- Gem::Ext
- Gem::Ext::Builder
- Gem::Platform
- Gem::Specification
- InvocationError
- Kernel
- MalformattedArgumentError
- Object
- Rake
- RequiredArgumentMissingError
- UndefinedCommandError
- UndefinedCommandError::SpellChecker
- UndefinedTaskError
- UnknownArgumentError
- UnknownArgumentError::SpellChecker

No matching classes.

# Bundler::Molinillo::DependencyGraph::Vertex

A vertex in a {DependencyGraph} that encapsulates a {#name} and a {#payload}

### Attributes

explicit_requirements[R]

@return [Array<Object>] the explicit requirements that required

    this vertex

incoming_edges[RW]

@return [Array<Edge>] the edges of {#graph} that have `self` as their

    {Edge#destination}

name[RW]

@return [String] the name of the vertex

outgoing_edges[RW]

@return [Array<Edge>] the edges of {#graph} that have `self` as their

    {Edge#origin}

payload[RW]

@return [Object] the payload the vertex holds

root[RW]

@return [Boolean] whether the vertex is considered a root vertex

root?[RW]

@return [Boolean] whether the vertex is considered a root vertex

### Public Class Methods

new(name, payload) click to toggle source

Initializes a vertex with the given name and payload. @param [String] name see {#name} @param [Object] payload see {#payload}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 25
    def initialize(name, payload)
      @name = name.frozen? ? name : name.dup.freeze
      @payload = payload
      @explicit_requirements = []
      @outgoing_edges = []
      @incoming_edges = []
    end

### Public Instance Methods

==(other) click to toggle source

@return [Boolean] whether the two vertices are equal, determined

    by a recursive traversal of each {Vertex#successors}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 106
    def ==(other)
      return true if equal?(other)
      shallow_eql?(other) &&
        successors.to_set == other.successors.to_set
    end

Also aliased as: eql?
ancestor?(other) click to toggle source

Is there a path from `other` to `self` following edges in the dependency graph? @return true iff there is a path following edges within this {#graph}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 151
    def ancestor?(other)
      other.path_to?(self)
    end

Also aliased as: is_reachable_from?
descendent?(other) click to toggle source
Alias for: path_to?
eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source

@return [Fixnum] a hash for the vertex based upon its {#name}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 125
    def hash
      name.hash
    end

inspect() click to toggle source

@return [String] a string suitable for debugging

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 100
    def inspect
      "#{self.class}:#{name}(#{payload.inspect})"
    end

is_reachable_from?(other) click to toggle source
Alias for: ancestor?
path_to?(other) click to toggle source

Is there a path from `self` to `other` following edges in the dependency graph? @return true iff there is a path following edges within this {#graph}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 132
    def path_to?(other)
      _path_to?(other)
    end

Also aliased as: descendent?
predecessors() click to toggle source

@return [Array<Vertex>] the vertices of {#graph} that have an edge with

    `self` as their {Edge#destination}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 49
    def predecessors
      incoming_edges.map(&:origin)
    end

recursive_predecessors() click to toggle source

@return [Set<Vertex>] the vertices of {#graph} where `self` is a

    {#descendent?}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 55
    def recursive_predecessors
      _recursive_predecessors
    end

recursive_successors() click to toggle source

@return [Set<Vertex>] the vertices of {#graph} where `self` is an

    {#ancestor?}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 81
    def recursive_successors
      _recursive_successors
    end

requirements() click to toggle source

@return [Array<Object>] all of the requirements that required

    this vertex

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 35
    def requirements
      (incoming_edges.map(&:requirement) + explicit_requirements).uniq
    end

shallow_eql?(other) click to toggle source

@param [Vertex] other the other vertex to compare to @return [Boolean] whether the two vertices are equal, determined

    solely by {#name} and {#payload} equality

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 115
    def shallow_eql?(other)
      return true if equal?(other)
      other &&
        name == other.name &&
        payload == other.payload
    end

successors() click to toggle source

@return [Array<Vertex>] the vertices of {#graph} that have an edge with

    `self` as their {Edge#origin}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 75
    def successors
      outgoing_edges.map(&:destination)
    end

### Protected Instance Methods

_path_to?(other, visited = Set.new) click to toggle source

@param [Vertex] other the vertex to check if there’s a path to @param [Set<Vertex>] visited the vertices of {#graph} that have been visited @return [Boolean] whether there is a path to `other` from `self`

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 141
    def _path_to?(other, visited = Set.new)
      return false unless visited.add?(self)
      return true if equal?(other)
      successors.any? { |v| v._path_to?(other, visited) }
    end

_recursive_predecessors(vertices = Set.new) click to toggle source

@param [Set<Vertex>] vertices the set to add the predecessors to @return [Set<Vertex>] the vertices of {#graph} where `self` is a

    {#descendent?}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 62
    def _recursive_predecessors(vertices = Set.new)
      incoming_edges.each do |edge|
        vertex = edge.origin
        next unless vertices.add?(vertex)
        vertex._recursive_predecessors(vertices)
      end

      vertices
    end

_recursive_successors(vertices = Set.new) click to toggle source

@param [Set<Vertex>] vertices the set to add the successors to @return [Set<Vertex>] the vertices of {#graph} where `self` is an

    {#ancestor?}

                   # File bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 88
    def _recursive_successors(vertices = Set.new)
      outgoing_edges.each do |edge|
        vertex = edge.destination
        next unless vertices.add?(vertex)
        vertex._recursive_successors(vertices)
      end

      vertices
    end