Class: ArchUnit::Metrics::FluentApi::MetricMeasurement
- Inherits:
-
Data
- Object
- Data
- ArchUnit::Metrics::FluentApi::MetricMeasurement
- Defined in:
- lib/archunit/metrics/fluentapi/metric_measurement.rb
Overview
One calculated metric value and the extracted subject it describes.
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:) ⇒ MetricMeasurement
constructor
A new instance of MetricMeasurement.
Constructor Details
#initialize(subject:, metric_name:, value:) ⇒ MetricMeasurement
Returns a new instance of MetricMeasurement.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 10 def initialize(subject:, metric_name:, value:) unless subject.respond_to?(:identifier) raise ArgumentError, 'subject must expose an identifier' end 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
9 10 11 |
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9 def metric_name @metric_name end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject
9 10 11 |
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9 def subject @subject end |
#value ⇒ Object (readonly)
Returns the value of attribute value
9 10 11 |
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9 def value @value end |
Instance Method Details
#identifier ⇒ Object
21 22 23 |
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 21 def identifier subject.identifier end |