Class: ArchUnit::Metrics::FluentApi::CustomMetricCondition

Inherits:
Object
  • Object
show all
Includes:
Common::FluentApi::Checkable
Defined in:
lib/archunit/metrics/fluentapi/custom_metric_condition.rb

Overview

Executable custom class-metric predicate.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::FluentApi::Checkable

#check

Constructor Details

#initialize(selection:, predicate:) ⇒ CustomMetricCondition

Returns a new instance of CustomMetricCondition.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
22
23
24
# File 'lib/archunit/metrics/fluentapi/custom_metric_condition.rb', line 15

def initialize(selection:, predicate:)
  unless selection.is_a?(CustomMetricBuilder)
    raise ArgumentError, 'selection must be a CustomMetricBuilder'
  end
  raise ArgumentError, 'predicate must respond to call' unless predicate.respond_to?(:call)

  @selection = selection
  @predicate = predicate.dup.freeze
  freeze
end

Instance Attribute Details

#predicateObject (readonly)

Returns the value of attribute predicate.



13
14
15
# File 'lib/archunit/metrics/fluentapi/custom_metric_condition.rb', line 13

def predicate
  @predicate
end

#selectionObject (readonly)

Returns the value of attribute selection.



13
14
15
# File 'lib/archunit/metrics/fluentapi/custom_metric_condition.rb', line 13

def selection
  @selection
end