Class: ArchUnit::Metrics::FluentApi::ZoneCondition

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

Overview

Executable guard that rejects files in one architectural distance zone.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::FluentApi::Checkable

#check

Constructor Details

#initialize(scope:, zone:) ⇒ ZoneCondition

Returns a new instance of ZoneCondition.

Raises:

  • (ArgumentError)


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

def initialize(scope:, zone:)
  raise ArgumentError, 'scope must be a MetricsBuilder' unless scope.is_a?(MetricsBuilder)
  unless Assertion::MetricZoneViolation::ZONES.include?(zone)
    raise ArgumentError, "unknown architectural zone: #{zone.inspect}"
  end

  @scope = scope
  @zone = zone
  freeze
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



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

def scope
  @scope
end

#zoneObject (readonly)

Returns the value of attribute zone.



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

def zone
  @zone
end