Exception: Dagable::Errors::CyclicAssociation

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dagable/errors/cyclic_association.rb

Overview

Raised when adding an edge would introduce a cycle into the DAG. This includes self-referential edges (A -> A), direct cycles (A -> B -> A), and transitive cycles (A -> B -> C -> A).

Constant Summary collapse

ERROR_MESSAGE =
"Cyclic association detected between %<parent>s and %<child>s"

Instance Method Summary collapse

Constructor Details

#initialize(parent, child) ⇒ CyclicAssociation

Returns a new instance of CyclicAssociation.



11
12
13
# File 'lib/dagable/errors/cyclic_association.rb', line 11

def initialize(parent, child)
  super(format(ERROR_MESSAGE, parent: "#{parent.class}##{parent.id}", child: "#{child.class}##{child.id}"))
end