Class: ArchUnit::Metrics::FluentApi::MetricThresholdCondition
- Inherits:
-
Object
- Object
- ArchUnit::Metrics::FluentApi::MetricThresholdCondition
- Includes:
- Common::FluentApi::Checkable
- Defined in:
- lib/archunit/metrics/fluentapi/metric_threshold_condition.rb
Overview
Executable numeric threshold over one selected metric.
Instance Attribute Summary collapse
-
#comparison ⇒ Object
readonly
Returns the value of attribute comparison.
-
#selection ⇒ Object
readonly
Returns the value of attribute selection.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
Instance Method Summary collapse
-
#initialize(selection:, comparison:, threshold:) ⇒ MetricThresholdCondition
constructor
A new instance of MetricThresholdCondition.
Methods included from Common::FluentApi::Checkable
Constructor Details
#initialize(selection:, comparison:, threshold:) ⇒ MetricThresholdCondition
Returns a new instance of MetricThresholdCondition.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 15 def initialize(selection:, comparison:, threshold:) unless selection.is_a?(MetricSelection) raise ArgumentError, 'selection must be a MetricSelection' end unless Assertion::MetricThresholdViolation::COMPARISONS.include?(comparison) raise ArgumentError, "unknown metric comparison: #{comparison.inspect}" end @selection = selection @comparison = comparison @threshold = Calculation::NumericValue.validate(threshold, attribute: 'threshold') freeze end |
Instance Attribute Details
#comparison ⇒ Object (readonly)
Returns the value of attribute comparison.
13 14 15 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 13 def comparison @comparison end |
#selection ⇒ Object (readonly)
Returns the value of attribute selection.
13 14 15 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 13 def selection @selection end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
13 14 15 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 13 def threshold @threshold end |