Class: ArchUnit::Files::Assertion::CycleViolation

Inherits:
Common::Assertion::Violation show all
Defined in:
lib/archunit/files/assertion/cycle_free.rb

Overview

Data describing one closed circular dependency path.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cycleObject (readonly)

Returns the value of attribute cycle.



12
13
14
# File 'lib/archunit/files/assertion/cycle_free.rb', line 12

def cycle
  @cycle
end

#pathObject (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

#hashObject



25
26
27
# File 'lib/archunit/files/assertion/cycle_free.rb', line 25

def hash
  [self.class, cycle].hash
end