Class: ArchUnit::Metrics::FluentApi::MetricMeasurement

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/metrics/fluentapi/metric_measurement.rb

Overview

One calculated metric value and the extracted subject it describes.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (readonly)

Returns the value of attribute metric_name

Returns:

  • (Object)

    the current value of metric_name



9
10
11
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9

def metric_name
  @metric_name
end

#subjectObject (readonly)

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



9
10
11
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9

def subject
  @subject
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



9
10
11
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 9

def value
  @value
end

Instance Method Details

#identifierObject



21
22
23
# File 'lib/archunit/metrics/fluentapi/metric_measurement.rb', line 21

def identifier
  subject.identifier
end