Class: ArchUnit::Files::Assertion::CycleViolation
- Inherits:
-
Common::Assertion::Violation
- Object
- Common::Assertion::Violation
- ArchUnit::Files::Assertion::CycleViolation
- Defined in:
- lib/archunit/files/assertion/cycle_free.rb
Overview
Data describing one closed circular dependency path.
Instance Attribute Summary collapse
-
#cycle ⇒ Object
readonly
Returns the value of attribute cycle.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(cycle:) ⇒ CycleViolation
constructor
A new instance of CycleViolation.
Constructor Details
#initialize(cycle:) ⇒ CycleViolation
Returns a new instance of CycleViolation.
14 15 16 17 18 |
# File 'lib/archunit/files/assertion/cycle_free.rb', line 14 def initialize(cycle:) @cycle = immutable_cycle(cycle) @path = [cycle.first.source_label, *cycle.map(&:target_label)].freeze super() end |
Instance Attribute Details
#cycle ⇒ Object (readonly)
Returns the value of attribute cycle.
12 13 14 |
# File 'lib/archunit/files/assertion/cycle_free.rb', line 12 def cycle @cycle end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
12 13 14 |
# File 'lib/archunit/files/assertion/cycle_free.rb', line 12 def path @path end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
20 21 22 |
# File 'lib/archunit/files/assertion/cycle_free.rb', line 20 def ==(other) other.is_a?(self.class) && cycle == other.cycle end |
#hash ⇒ Object
25 26 27 |
# File 'lib/archunit/files/assertion/cycle_free.rb', line 25 def hash [self.class, cycle].hash end |