Class: IncludeDependencyGraph
- Inherits:
-
Object
- Object
- IncludeDependencyGraph
- Defined in:
- lib/cpp_dependency_graph/include_dependency_graph.rb
Overview
Returns a hash of intra-component include links
Instance Method Summary collapse
- #include_links(component_name) ⇒ Object
-
#initialize(project) ⇒ IncludeDependencyGraph
constructor
A new instance of IncludeDependencyGraph.
Constructor Details
#initialize(project) ⇒ IncludeDependencyGraph
Returns a new instance of IncludeDependencyGraph.
9 10 11 |
# File 'lib/cpp_dependency_graph/include_dependency_graph.rb', line 9 def initialize(project) @project = project end |
Instance Method Details
#include_links(component_name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cpp_dependency_graph/include_dependency_graph.rb', line 13 def include_links(component_name) component = @project.source_component(component_name) source_files = component.source_files source_files.map do |file| class_name = file.basename # TODO: Very inefficient internal_includes = file.includes.reject { |inc| @project.external_includes(component).any?(inc) } include_links = internal_includes.map { |inc| ComponentLink.new(class_name, inc, false) } [class_name, include_links] end.to_h end |