Class: ArchUnit::Files::FluentApi::DependOnFileCondition

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

Overview

Executable internal file-dependency rule with chainable object selectors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::FluentApi::Checkable

#check

Constructor Details

#initialize(builder, object_filters:) ⇒ DependOnFileCondition

Returns a new instance of DependOnFileCondition.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 20

def initialize(builder, object_filters:)
  unless builder.is_a?(DependOnFileConditionBuilder)
    raise ArgumentError, 'builder must be a DependOnFileConditionBuilder'
  end

  @builder = builder
  @project_locator = builder.project_locator
  @subject_filters = builder.subject_filters
  @object_filters = immutable_object_filters(object_filters)
  @is_negated = builder.negated?
  freeze
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



18
19
20
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 18

def builder
  @builder
end

#is_negatedObject (readonly)

Returns the value of attribute is_negated.



18
19
20
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 18

def is_negated
  @is_negated
end

#object_filtersObject (readonly)

Returns the value of attribute object_filters.



18
19
20
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 18

def object_filters
  @object_filters
end

#project_locatorObject (readonly)

Returns the value of attribute project_locator.



18
19
20
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 18

def project_locator
  @project_locator
end

#subject_filtersObject (readonly)

Returns the value of attribute subject_filters.



18
19
20
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 18

def subject_filters
  @subject_filters
end

Instance Method Details

#in_folder(pattern, except: nil) ⇒ Object



41
42
43
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 41

def in_folder(pattern, except: nil)
  with_filter(Common::RegexFactory.folder_matcher(pattern, except:))
end

#in_path(pattern, except: nil) ⇒ Object



45
46
47
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 45

def in_path(pattern, except: nil)
  with_filter(Common::RegexFactory.path_matcher(pattern, except:))
end

#negated?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 33

def negated?
  is_negated
end

#with_name(pattern, except: nil) ⇒ Object



37
38
39
# File 'lib/archunit/files/fluentapi/depend_on_file_condition.rb', line 37

def with_name(pattern, except: nil)
  with_filter(Common::RegexFactory.filename_matcher(pattern, except:))
end