Class: IncludeComponentDependencyGraph
- Inherits:
-
Object
- Object
- IncludeComponentDependencyGraph
- Defined in:
- lib/cpp_dependency_graph/include_component_dependency_graph.rb
Overview
Returns a hash of intra-component include links
Instance Method Summary collapse
- #all_cyclic_links ⇒ Object
- #all_links ⇒ Object
-
#initialize(project) ⇒ IncludeComponentDependencyGraph
constructor
A new instance of IncludeComponentDependencyGraph.
- #links(component_name) ⇒ Object
Constructor Details
#initialize(project) ⇒ IncludeComponentDependencyGraph
Returns a new instance of IncludeComponentDependencyGraph.
9 10 11 |
# File 'lib/cpp_dependency_graph/include_component_dependency_graph.rb', line 9 def initialize(project) @project = project end |
Instance Method Details
#all_cyclic_links ⇒ Object
20 21 22 |
# File 'lib/cpp_dependency_graph/include_component_dependency_graph.rb', line 20 def all_cyclic_links # TODO: Implement end |
#all_links ⇒ Object
13 14 15 16 17 18 |
# File 'lib/cpp_dependency_graph/include_component_dependency_graph.rb', line 13 def all_links @project.source_files.map do |file| links = file.includes.map { |inc| Link.new(file.basename, inc, false) } [file.basename, links] end.to_h end |
#links(component_name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cpp_dependency_graph/include_component_dependency_graph.rb', line 24 def links(component_name) component = @project.source_component(component_name) source_files = component.source_files external_includes = @project.external_includes(component) source_files.map do |file| # TODO: Very inefficient internal_includes = file.includes.reject { |inc| external_includes.any?(inc) } links = internal_includes.map { |inc| Link.new(file.basename, inc, false) } [file.basename, links] end.to_h end |