Class: ArchUnit::Metrics::FluentApi::MetricPredicateCondition

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

Overview

Executable arbitrary predicate over one selected built-in metric.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::FluentApi::Checkable

#check

Constructor Details

#initialize(selection:, predicate:) ⇒ MetricPredicateCondition

Returns a new instance of MetricPredicateCondition.

Raises:

  • (ArgumentError)


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

def initialize(selection:, predicate:)
  unless selection.is_a?(MetricSelection)
    raise ArgumentError, 'selection must be a MetricSelection'
  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/metric_predicate_condition.rb', line 13

def predicate
  @predicate
end

#selectionObject (readonly)

Returns the value of attribute selection.



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

def selection
  @selection
end