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') ⇒ ProjectGraphBuilder
Groups node names through a regular-expression replacement.
-
#collapse_to_folder_depth(depth) ⇒ ProjectGraphBuilder
Groups file nodes by the requested project-relative folder depth.
-
#dependents_of(pattern, except: nil) ⇒ ProjectGraphBuilder
Keeps matching nodes and everything that depends on them.
-
#export_as_csv(output_path) ⇒ nil
Writes CSV to output_path.
-
#export_as_d2(output_path) ⇒ nil
Writes D2 to output_path.
-
#export_as_dot(output_path) ⇒ nil
Writes Graphviz DOT to output_path.
-
#export_as_html(output_path) ⇒ nil
Writes self-contained HTML to output_path.
-
#export_as_json(output_path) ⇒ nil
Writes JSON to output_path.
-
#export_as_mermaid(output_path) ⇒ nil
Writes Mermaid to output_path.
-
#focus_on(pattern, depth = 1, except: nil) ⇒ ProjectGraphBuilder
Keeps matching nodes and neighbors within depth hops.
-
#include_external_dependencies ⇒ ProjectGraphBuilder
Includes standard-library and gem imports in the report.
-
#include_self_dependencies ⇒ ProjectGraphBuilder
Includes the self-edges that represent dependency-free source files.
-
#initialize(project_locator: nil, options: nil, check_options: nil) ⇒ ProjectGraphBuilder
constructor
A new instance of ProjectGraphBuilder.
-
#reachable_from(pattern, except: nil) ⇒ ProjectGraphBuilder
Keeps nodes reachable from matching starting nodes.
-
#snapshot ⇒ GraphReportSnapshot
The immutable queried graph.
-
#summary ⇒ GraphReportSummary
Counts for the current snapshot.
-
#titled(title) ⇒ ProjectGraphBuilder
Sets the report title.
-
#to_csv ⇒ String
The current graph report as CSV.
-
#to_d2 ⇒ String
The current graph report as D2.
-
#to_dot ⇒ String
The current graph report as Graphviz DOT.
-
#to_html ⇒ String
The current graph report as self-contained HTML.
-
#to_json ⇒ String
The current graph report as JSON.
-
#to_mermaid ⇒ String
The current graph report as Mermaid.
-
#with_check_options(value) ⇒ ProjectGraphBuilder
Attaches extraction-related CheckOptions to this report.
Constructor Details
#initialize(project_locator: nil, options: nil, check_options: nil) ⇒ ProjectGraphBuilder
Returns a new instance of ProjectGraphBuilder.
40 41 42 43 44 45 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 40 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.
38 39 40 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 38 def @check_options end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
38 39 40 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 38 def @options end |
#project_locator ⇒ Object (readonly)
Returns the value of attribute project_locator.
38 39 40 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 38 def project_locator @project_locator end |
Instance Method Details
#collapse_by_pattern(pattern, replacement = '\\1') ⇒ ProjectGraphBuilder
Groups node names through a regular-expression replacement.
88 89 90 91 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 88 def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end |
#collapse_to_folder_depth(depth) ⇒ ProjectGraphBuilder
Groups file nodes by the requested project-relative folder depth.
82 83 84 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 82 def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end |
#dependents_of(pattern, except: nil) ⇒ ProjectGraphBuilder
Keeps matching nodes and everything that depends on them.
75 76 77 78 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 75 def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end |
#export_as_csv(output_path) ⇒ nil
Returns writes CSV to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#export_as_d2(output_path) ⇒ nil
Returns writes D2 to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#export_as_dot(output_path) ⇒ nil
Returns writes Graphviz DOT to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#export_as_html(output_path) ⇒ nil
Returns writes self-contained HTML to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#export_as_json(output_path) ⇒ nil
Returns writes JSON to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#export_as_mermaid(output_path) ⇒ nil
Returns writes Mermaid to output_path.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#focus_on(pattern, depth = 1, except: nil) ⇒ ProjectGraphBuilder
Keeps matching nodes and neighbors within depth hops.
61 62 63 64 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 61 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 ⇒ ProjectGraphBuilder
Includes standard-library and gem imports in the report.
49 50 51 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 49 def include_external_dependencies (.with(include_external_dependencies: true)) end |
#include_self_dependencies ⇒ ProjectGraphBuilder
Includes the self-edges that represent dependency-free source files.
55 56 57 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 55 def include_self_dependencies (.with(include_self_dependencies: true)) end |
#reachable_from(pattern, except: nil) ⇒ ProjectGraphBuilder
Keeps nodes reachable from matching starting nodes.
68 69 70 71 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 68 def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end |
#snapshot ⇒ GraphReportSnapshot
Returns the immutable queried graph.
106 107 108 109 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 106 def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end |
#summary ⇒ GraphReportSummary
Returns counts for the current snapshot.
112 113 114 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 112 def summary snapshot.summary end |
#titled(title) ⇒ ProjectGraphBuilder
Sets the report title.
95 96 97 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 95 def titled(title) (.with(title:)) end |
#to_csv ⇒ String
Returns the current graph report as CSV.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#to_d2 ⇒ String
Returns the current graph report as D2.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#to_dot ⇒ String
Returns the current graph report as Graphviz DOT.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#to_html ⇒ String
Returns the current graph report as self-contained HTML.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#to_json ⇒ String
Returns the current graph report as JSON.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#to_mermaid ⇒ String
Returns the current graph report as Mermaid.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 37 class ProjectGraphBuilder attr_reader :project_locator, :options, :check_options 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 # Includes standard-library and gem imports in the report. # @return [ProjectGraphBuilder] def include_external_dependencies (.with(include_external_dependencies: true)) end # Includes the self-edges that represent dependency-free source files. # @return [ProjectGraphBuilder] def include_self_dependencies (.with(include_self_dependencies: true)) end # Keeps matching nodes and neighbors within depth hops. # @return [ProjectGraphBuilder] def focus_on(pattern, depth = 1, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(focus: filter, focus_depth: depth)) end # Keeps nodes reachable from matching starting nodes. # @return [ProjectGraphBuilder] def reachable_from(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(reachable_from: filter)) end # Keeps matching nodes and everything that depends on them. # @return [ProjectGraphBuilder] def dependents_of(pattern, except: nil) filter = Common::RegexFactory.path_matcher(pattern, except:) (.with(dependents_of: filter)) end # Groups file nodes by the requested project-relative folder depth. # @return [ProjectGraphBuilder] def collapse_to_folder_depth(depth) (.with(collapse: Projection::FolderDepthCollapse.new(depth:))) end # Groups node names through a regular-expression replacement. # @return [ProjectGraphBuilder] def collapse_by_pattern(pattern, replacement = '\\1') collapse = Projection::PatternCollapse.from(pattern, replacement) (.with(collapse:)) end # Sets the report title. # @return [ProjectGraphBuilder] def titled(title) (.with(title:)) end # Attaches extraction-related CheckOptions to this report. # @return [ProjectGraphBuilder] def (value) self.class.new(project_locator:, options:, check_options: value) end # @return [GraphReportSnapshot] the immutable queried graph def snapshot graph = ArchUnit::Extraction.extract_graph(project_locator, options: ) Projection::SnapshotFactory.create(graph, ) end # @return [GraphReportSummary] counts for the current snapshot def summary snapshot.summary end Rendering::GraphRenderer::RENDERERS.each_key do |format| define_method("to_#{format}") do Rendering::GraphRenderer.render(snapshot, format) end define_method("export_as_#{format}") do |output_path| Rendering::GraphRenderer.export(snapshot, format, output_path) end end private def () self.class.new(project_locator:, options: , check_options:) end def immutable_project_locator(locator) return if locator.nil? locator = locator.to_path if locator.respond_to?(:to_path) return locator.dup.freeze if locator.is_a?(String) && !locator.empty? raise ArgumentError, 'project_locator must be a non-empty path or nil' end def (value) return if value.nil? return value if value.is_a?(Common::FluentApi::CheckOptions) raise ArgumentError, 'check_options must be a CheckOptions value or nil' end end |
#with_check_options(value) ⇒ ProjectGraphBuilder
Attaches extraction-related CheckOptions to this report.
101 102 103 |
# File 'lib/archunit/graph/fluentapi/project_graph_builder.rb', line 101 def (value) self.class.new(project_locator:, options:, check_options: value) end |
ArchUnitRuby