Class: ArchUnit::GraphReporting::FluentApi::ProjectGraphBuilder
- Inherits:
-
Object
- Object
- ArchUnit::GraphReporting::FluentApi::ProjectGraphBuilder
- Defined in:
- lib/archunit/graph/fluentapi/project_graph_builder.rb
Overview
Immutable query builder for dependency graph snapshots and reports.
Instance Attribute Summary collapse
-
#check_options ⇒ Object
readonly
Returns the value of attribute check_options.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#project_locator ⇒ Object
readonly
Returns the value of attribute project_locator.
Instance Method Summary collapse
- #collapse_by_pattern(pattern, replacement = '\\1') ⇒ Object
- #collapse_to_folder_depth(depth) ⇒ Object
- #dependents_of(pattern, except: nil) ⇒ Object
- #focus_on(pattern, depth = 1, except: nil) ⇒ Object
- #include_external_dependencies ⇒ Object
- #include_self_dependencies ⇒ Object
-
#initialize(project_locator: nil, options: nil, check_options: nil) ⇒ ProjectGraphBuilder
constructor
A new instance of ProjectGraphBuilder.
- #reachable_from(pattern, except: nil) ⇒ Object
- #snapshot ⇒ Object
- #summary ⇒ Object
- #titled(title) ⇒ Object
- #with_check_options(value) ⇒ Object
Constructor Details
#initialize(project_locator: nil, options: nil, check_options: nil) ⇒ ProjectGraphBuilder
Returns a new instance of ProjectGraphBuilder.
16 17 18 19 20 21 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 16 def initialize(project_locator: nil, options: nil, check_options: nil) @project_locator = immutable_project_locator(project_locator) @options = Projection::GraphQueryOptions.resolve() @check_options = () freeze end |
Instance Attribute Details
#check_options ⇒ Object (readonly)
Returns the value of attribute check_options.
14 15 16 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 14 def @check_options end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 14 def @options end |
#project_locator ⇒ Object (readonly)
Returns the value of attribute project_locator.
14 15 16 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 14 def project_locator @project_locator end |
Instance Method Details
#collapse_by_pattern(pattern, replacement = '\\1') ⇒ Object
50 51 52 53 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 50 def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end |
#collapse_to_folder_depth(depth) ⇒ Object
46 47 48 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 46 def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end |
#dependents_of(pattern, except: nil) ⇒ Object
41 42 43 44 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 41 def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end |
#focus_on(pattern, depth = 1, except: nil) ⇒ Object
31 32 33 34 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 31 def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end |
#include_external_dependencies ⇒ Object
23 24 25 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 23 def include_external_dependencies (.with(include_external_dependencies: true)) end |
#include_self_dependencies ⇒ Object
27 28 29 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 27 def include_self_dependencies (.with(include_self_dependencies: true)) end |
#reachable_from(pattern, except: nil) ⇒ Object
36 37 38 39 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 36 def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end |
#snapshot ⇒ Object
63 64 65 66 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 63 def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end |
#summary ⇒ Object
68 69 70 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 68 def summary snapshot.summary end |
#titled(title) ⇒ Object
55 56 57 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 55 def titled(title) (.with(title:)) end |
#with_check_options(value) ⇒ Object
59 60 61 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 59 def (value) self.class.new(project_locator:, options:, check_options: value) end |