class GitCompound::Worker::CircularDependencyChecker

Worker that checks if unwanted circular dependency exists

Public Instance Methods

visit_component(component) click to toggle source
# File lib/git_compound/worker/circular_dependency_checker.rb, line 6
def visit_component(component)
  @element = component
  raise_error if circular_dependency_exists?
end
visit_manifest(manifest) click to toggle source
# File lib/git_compound/worker/circular_dependency_checker.rb, line 11
def visit_manifest(manifest)
  @element = manifest
  raise_error if circular_dependency_exists?
end

Private Instance Methods

circular_dependency_exists?() click to toggle source
# File lib/git_compound/worker/circular_dependency_checker.rb, line 18
def circular_dependency_exists?
  @element.ancestors.include?(@element)
end
raise_error() click to toggle source
# File lib/git_compound/worker/circular_dependency_checker.rb, line 22
def raise_error
  name = @element.name
  type = @element.class.name.downcase

  raise CircularDependencyError,
        "Circular dependency detected in #{type} `#{name}`!"
end