Class: ArchUnit::Layers::Assertion::LayerDependencyViolation
- Inherits:
-
Common::Assertion::Violation
- Object
- Common::Assertion::Violation
- ArchUnit::Layers::Assertion::LayerDependencyViolation
- Defined in:
- lib/archunit/layers/assertion/layer_dependency_violation.rb
Overview
Data describing one cross-layer edge rejected by a layer policy.
Constant Summary collapse
- RULES =
%i[may_only_depend_on_layers may_not_depend_on_layers].freeze
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#source_layer ⇒ Object
readonly
Returns the value of attribute source_layer.
-
#target_layer ⇒ Object
readonly
Returns the value of attribute target_layer.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(dependency:, source_layer:, target_layer:, rule:) ⇒ LayerDependencyViolation
constructor
A new instance of LayerDependencyViolation.
Constructor Details
#initialize(dependency:, source_layer:, target_layer:, rule:) ⇒ LayerDependencyViolation
Returns a new instance of LayerDependencyViolation.
16 17 18 19 20 21 22 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 16 def initialize(dependency:, source_layer:, target_layer:, rule:) @dependency = projected_edge(dependency) @source_layer = layer_name(source_layer, :source_layer) @target_layer = layer_name(target_layer, :target_layer) @rule = rule_value(rule) super() end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
14 15 16 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 14 def dependency @dependency end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
14 15 16 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 14 def rule @rule end |
#source_layer ⇒ Object (readonly)
Returns the value of attribute source_layer.
14 15 16 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 14 def source_layer @source_layer end |
#target_layer ⇒ Object (readonly)
Returns the value of attribute target_layer.
14 15 16 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 14 def target_layer @target_layer end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
24 25 26 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 24 def ==(other) other.is_a?(self.class) && values == other.send(:values) end |
#hash ⇒ Object
29 30 31 |
# File 'lib/archunit/layers/assertion/layer_dependency_violation.rb', line 29 def hash [self.class, *values].hash end |