Class: ArchUnit::Files::FluentApi::DependOnExternalModuleConditionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb

Overview

Immutable object stage selecting external dependency names.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mood) ⇒ DependOnExternalModuleConditionBuilder

Returns a new instance of DependOnExternalModuleConditionBuilder.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 13

def initialize(mood)
  unless mood.is_a?(MatchPatternFileConditionBuilder)
    raise ArgumentError, 'mood must be a file condition builder'
  end

  @mood = mood
  @project_locator = mood.project_locator
  @subject_filters = mood.filters
  @is_negated = mood.negated?
  freeze
end

Instance Attribute Details

#is_negatedObject (readonly)

Returns the value of attribute is_negated.



11
12
13
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 11

def is_negated
  @is_negated
end

#moodObject (readonly)

Returns the value of attribute mood.



11
12
13
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 11

def mood
  @mood
end

#project_locatorObject (readonly)

Returns the value of attribute project_locator.



11
12
13
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 11

def project_locator
  @project_locator
end

#subject_filtersObject (readonly)

Returns the value of attribute subject_filters.



11
12
13
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 11

def subject_filters
  @subject_filters
end

Instance Method Details

#matching(module_name, except: nil) ⇒ Object



29
30
31
32
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 29

def matching(module_name, except: nil)
  filter = Common::RegexFactory.path_matcher(module_name, except:)
  DependOnExternalModuleCondition.new(self, module_filters: [filter])
end

#negated?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/archunit/files/fluentapi/depend_on_external_module_condition_builder.rb', line 25

def negated?
  is_negated
end