Class: ArchUnit::Metrics::Assertion::MetricPredicateViolation
- Inherits:
-
Common::Assertion::Violation
- Object
- Common::Assertion::Violation
- ArchUnit::Metrics::Assertion::MetricPredicateViolation
- Defined in:
- lib/archunit/metrics/assertion/metric_predicate.rb
Overview
One built-in metric value that did not satisfy a user predicate.
Instance Attribute Summary collapse
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(subject:, metric_name:, value:) ⇒ MetricPredicateViolation
constructor
A new instance of MetricPredicateViolation.
Constructor Details
#initialize(subject:, metric_name:, value:) ⇒ MetricPredicateViolation
Returns a new instance of MetricPredicateViolation.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/archunit/metrics/assertion/metric_predicate.rb', line 15 def initialize(subject:, metric_name:, value:) unless subject.respond_to?(:identifier) raise ArgumentError, 'subject must expose an identifier' end @subject = subject @metric_name = immutable_metric_name(metric_name) @value = Calculation::NumericValue.validate(value) super() end |
Instance Attribute Details
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
13 14 15 |
# File 'lib/archunit/metrics/assertion/metric_predicate.rb', line 13 def metric_name @metric_name end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
13 14 15 |
# File 'lib/archunit/metrics/assertion/metric_predicate.rb', line 13 def subject @subject end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
13 14 15 |
# File 'lib/archunit/metrics/assertion/metric_predicate.rb', line 13 def value @value end |
Instance Method Details
#identifier ⇒ Object
26 27 28 |
# File 'lib/archunit/metrics/assertion/metric_predicate.rb', line 26 def identifier subject.identifier end |