Class: ArchUnit::Files::FluentApi::FileConditionBuilder
- Inherits:
-
Object
- Object
- ArchUnit::Files::FluentApi::FileConditionBuilder
- Defined in:
- lib/archunit/files/fluentapi/file_condition_builder.rb
Overview
Immutable scope builder selecting the files to which a rule will apply.
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#project_locator ⇒ Object
readonly
Returns the value of attribute project_locator.
Instance Method Summary collapse
-
#in_file(file_path, except: nil) ⇒ FileConditionBuilder
Selects one exact project-relative file.
-
#in_folder(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by project-relative containing folder.
-
#in_path(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by complete project-relative path.
-
#initialize(project_locator: nil, filters: []) ⇒ FileConditionBuilder
constructor
A new instance of FileConditionBuilder.
-
#should ⇒ PositiveMatchPatternFileConditionBuilder
Enters the positive rule mood.
-
#should_not ⇒ NegatedMatchPatternFileConditionBuilder
Enters the negated rule mood.
-
#with_name(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by basename.
Constructor Details
#initialize(project_locator: nil, filters: []) ⇒ FileConditionBuilder
Returns a new instance of FileConditionBuilder.
13 14 15 16 17 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 13 def initialize(project_locator: nil, filters: []) @project_locator = immutable_project_locator(project_locator) @filters = immutable_filters(filters) freeze end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
11 12 13 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 11 def filters @filters end |
#project_locator ⇒ Object (readonly)
Returns the value of attribute project_locator.
11 12 13 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 11 def project_locator @project_locator end |
Instance Method Details
#in_file(file_path, except: nil) ⇒ FileConditionBuilder
Selects one exact project-relative file.
39 40 41 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 39 def in_file(file_path, except: nil) with_filter(Common::RegexFactory.exact_file_matcher(file_path, except:)) end |
#in_folder(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by project-relative containing folder.
27 28 29 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 27 def in_folder(pattern, except: nil) with_filter(Common::RegexFactory.folder_matcher(pattern, except:)) end |
#in_path(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by complete project-relative path.
33 34 35 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 33 def in_path(pattern, except: nil) with_filter(Common::RegexFactory.path_matcher(pattern, except:)) end |
#should ⇒ PositiveMatchPatternFileConditionBuilder
Enters the positive rule mood.
45 46 47 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 45 def should PositiveMatchPatternFileConditionBuilder.new(self) end |
#should_not ⇒ NegatedMatchPatternFileConditionBuilder
Enters the negated rule mood.
51 52 53 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 51 def should_not NegatedMatchPatternFileConditionBuilder.new(self) end |
#with_name(pattern, except: nil) ⇒ FileConditionBuilder
Selects files by basename.
21 22 23 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 21 def with_name(pattern, except: nil) with_filter(Common::RegexFactory.filename_matcher(pattern, except:)) end |
ArchUnitRuby