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) ⇒ Object
- #in_folder(pattern, except: nil) ⇒ Object
- #in_path(pattern, except: nil) ⇒ Object
-
#initialize(project_locator: nil, filters: []) ⇒ FileConditionBuilder
constructor
A new instance of FileConditionBuilder.
- #should ⇒ Object
- #should_not ⇒ Object
- #with_name(pattern, except: nil) ⇒ Object
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) ⇒ Object
31 32 33 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 31 def in_file(file_path, except: nil) with_filter(Common::RegexFactory.exact_file_matcher(file_path, except:)) end |
#in_folder(pattern, except: nil) ⇒ Object
23 24 25 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 23 def in_folder(pattern, except: nil) with_filter(Common::RegexFactory.folder_matcher(pattern, except:)) end |
#in_path(pattern, except: nil) ⇒ Object
27 28 29 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 27 def in_path(pattern, except: nil) with_filter(Common::RegexFactory.path_matcher(pattern, except:)) end |
#should ⇒ Object
35 36 37 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 35 def should PositiveMatchPatternFileConditionBuilder.new(self) end |
#should_not ⇒ Object
39 40 41 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 39 def should_not NegatedMatchPatternFileConditionBuilder.new(self) end |
#with_name(pattern, except: nil) ⇒ Object
19 20 21 |
# File 'lib/archunit/files/fluentapi/file_condition_builder.rb', line 19 def with_name(pattern, except: nil) with_filter(Common::RegexFactory.filename_matcher(pattern, except:)) end |