Class: ArchUnit::Metrics::Assertion::MetricThresholdViolation
- Inherits:
-
Common::Assertion::Violation
- Object
- Common::Assertion::Violation
- ArchUnit::Metrics::Assertion::MetricThresholdViolation
- Defined in:
- lib/archunit/metrics/assertion/metric_threshold.rb
Overview
One metric value that did not meet its numeric threshold.
Constant Summary collapse
- COMPARISONS =
%i[below above equal below_or_equal above_or_equal].freeze
Instance Attribute Summary collapse
-
#comparison ⇒ Object
readonly
Returns the value of attribute comparison.
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(subject:, metric_name:, value:, threshold:, comparison:) ⇒ MetricThresholdViolation
constructor
A new instance of MetricThresholdViolation.
Constructor Details
#initialize(subject:, metric_name:, value:, threshold:, comparison:) ⇒ MetricThresholdViolation
Returns a new instance of MetricThresholdViolation.
17 18 19 20 21 22 23 24 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 17 def initialize(subject:, metric_name:, value:, threshold:, comparison:) @subject = validated_subject(subject) @metric_name = immutable_metric_name(metric_name) @value = Calculation::NumericValue.validate(value) @threshold = Calculation::NumericValue.validate(threshold, attribute: 'threshold') @comparison = validated_comparison(comparison) super() end |
Instance Attribute Details
#comparison ⇒ Object (readonly)
Returns the value of attribute comparison.
15 16 17 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 15 def comparison @comparison end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
15 16 17 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 15 def metric_name @metric_name end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
15 16 17 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 15 def subject @subject end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
15 16 17 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 15 def threshold @threshold end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
15 16 17 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 15 def value @value end |
Instance Method Details
#identifier ⇒ Object
26 27 28 |
# File 'lib/archunit/metrics/assertion/metric_threshold.rb', line 26 def identifier subject.identifier end |