Class: ArchUnit::Slices::FluentApi::SliceScopeBuilder
- Inherits:
-
Object
- Object
- ArchUnit::Slices::FluentApi::SliceScopeBuilder
- Defined in:
- lib/archunit/slices/fluentapi/slice_scope_builder.rb
Overview
Immutable scope describing how project files become named slices.
Instance Attribute Summary collapse
-
#project_locator ⇒ Object
readonly
Returns the value of attribute project_locator.
-
#projection ⇒ Object
readonly
Returns the value of attribute projection.
Instance Method Summary collapse
- #defined_by(pattern, except: nil) ⇒ Object
- #defined_by_regex(regexp, except: nil) ⇒ Object
- #export_as_plantuml(output_path, options = nil) ⇒ Object
-
#initialize(project_locator: nil, projection: Projection.identity) ⇒ SliceScopeBuilder
constructor
A new instance of SliceScopeBuilder.
- #should ⇒ Object
- #should_not ⇒ Object
- #to_plantuml(options = nil) ⇒ Object
Constructor Details
#initialize(project_locator: nil, projection: Projection.identity) ⇒ SliceScopeBuilder
Returns a new instance of SliceScopeBuilder.
19 20 21 22 23 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 19 def initialize(project_locator: nil, projection: Projection.identity) @project_locator = immutable_project_locator(project_locator) @projection = projection_value(projection) freeze end |
Instance Attribute Details
#project_locator ⇒ Object (readonly)
Returns the value of attribute project_locator.
17 18 19 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 17 def project_locator @project_locator end |
#projection ⇒ Object (readonly)
Returns the value of attribute projection.
17 18 19 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 17 def projection @projection end |
Instance Method Details
#defined_by(pattern, except: nil) ⇒ Object
25 26 27 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 25 def defined_by(pattern, except: nil) copy(projection: Projection.slice_by_pattern(pattern, except:)) end |
#defined_by_regex(regexp, except: nil) ⇒ Object
29 30 31 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 29 def defined_by_regex(regexp, except: nil) copy(projection: Projection.slice_by_regex(regexp, except:)) end |
#export_as_plantuml(output_path, options = nil) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 47 def export_as_plantuml(output_path, = nil) graph = extract_graph() edges = Common::Projection.project_edges(graph, projection) Uml::PlantUmlRenderer.export( edges, output_path, components: projection.slice_labels(graph) ) end |
#should ⇒ Object
37 38 39 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 37 def should PositiveSliceConditionBuilder.new(self) end |
#should_not ⇒ Object
33 34 35 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 33 def should_not NegativeSliceConditionBuilder.new(self) end |
#to_plantuml(options = nil) ⇒ Object
41 42 43 44 45 |
# File 'lib/archunit/slices/fluentapi/slice_scope_builder.rb', line 41 def to_plantuml( = nil) graph = extract_graph() edges = Common::Projection.project_edges(graph, projection) Uml::PlantUmlRenderer.render(edges, components: projection.slice_labels(graph)) end |