Class: ArchUnit::Slices::FluentApi::PositiveSliceConditionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb

Overview

Immutable positive mood and optional modifiers for diagram adherence.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, options: Assertion::DiagramAdherenceOptions.new) ⇒ PositiveSliceConditionBuilder

Returns a new instance of PositiveSliceConditionBuilder.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 14

def initialize(scope, options: Assertion::DiagramAdherenceOptions.new)
  unless scope.is_a?(SliceScopeBuilder)
    raise ArgumentError, 'scope must be a SliceScopeBuilder'
  end
  unless options.is_a?(Assertion::DiagramAdherenceOptions)
    raise ArgumentError, 'options must be DiagramAdherenceOptions'
  end

  @scope = scope
  @options = options
  freeze
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 12

def options
  @options
end

#scopeObject (readonly)

Returns the value of attribute scope.



12
13
14
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 12

def scope
  @scope
end

Instance Method Details

#adhere_to_diagram(text) ⇒ Object



35
36
37
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 35

def adhere_to_diagram(text)
  DiagramSliceCondition.new(scope, DiagramSource.inline(text), options:)
end

#adhere_to_diagram_in_file(path) ⇒ Object



39
40
41
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 39

def adhere_to_diagram_in_file(path)
  DiagramSliceCondition.new(scope, DiagramSource.file(path), options:)
end

#ignoring_external_slicesObject



31
32
33
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 31

def ignoring_external_slices
  copy(options.with(ignore_external_slices: true))
end

#ignoring_orphan_slicesObject



27
28
29
# File 'lib/archunit/slices/fluentapi/positive_slice_condition_builder.rb', line 27

def ignoring_orphan_slices
  copy(options.with(ignore_orphan_slices: true))
end