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.
Attributes included from Common::FluentApi::Checkable
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.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 16 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.
14 15 16 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 14 def comparison @comparison end |
#selection ⇒ Object (readonly)
Returns the value of attribute selection.
14 15 16 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 14 def selection @selection end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
14 15 16 |
# File 'lib/archunit/metrics/fluentapi/metric_threshold_condition.rb', line 14 def threshold @threshold end |
ArchUnitRuby