Class: ArchUnit::Slices::Assertion::SliceDependencyViolation

Inherits:
Common::Assertion::Violation show all
Defined in:
lib/archunit/slices/assertion/slice_dependency_violation.rb

Overview

Structured evidence for a dependency rejected by a slice rule.

Constant Summary collapse

RULES =
%i[contain_dependency adhere_to_diagram].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, source_slice:, target_slice:, rule:, is_negated:) ⇒ SliceDependencyViolation

Returns a new instance of SliceDependencyViolation.



16
17
18
19
20
21
22
23
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 16

def initialize(dependency:, source_slice:, target_slice:, rule:, is_negated:)
  @dependency = projected_edge(dependency)
  @source_slice = slice_name(source_slice, :source_slice)
  @target_slice = slice_name(target_slice, :target_slice)
  @rule = rule_value(rule)
  @is_negated = boolean(is_negated, :is_negated)
  super()
end

Instance Attribute Details

#dependencyObject (readonly)

Returns the value of attribute dependency.



14
15
16
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 14

def dependency
  @dependency
end

#is_negatedObject (readonly)

Returns the value of attribute is_negated.



14
15
16
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 14

def is_negated
  @is_negated
end

#ruleObject (readonly)

Returns the value of attribute rule.



14
15
16
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 14

def rule
  @rule
end

#source_sliceObject (readonly)

Returns the value of attribute source_slice.



14
15
16
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 14

def source_slice
  @source_slice
end

#target_sliceObject (readonly)

Returns the value of attribute target_slice.



14
15
16
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 14

def target_slice
  @target_slice
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



29
30
31
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 29

def ==(other)
  other.is_a?(self.class) && values == other.send(:values)
end

#hashObject



34
35
36
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 34

def hash
  [self.class, *values].hash
end

#negated?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/archunit/slices/assertion/slice_dependency_violation.rb', line 25

def negated?
  is_negated
end