Class: Project
- Inherits:
-
Object
- Object
- Project
- Defined in:
- lib/cpp_dependency_graph/project.rb
Overview
Parses all components of a project
Instance Method Summary collapse
- #dependencies(component) ⇒ Object
- #external_includes(component) ⇒ Object
-
#initialize(path) ⇒ Project
constructor
A new instance of Project.
- #source_component(name) ⇒ Object
- #source_components ⇒ Object
Constructor Details
#initialize(path) ⇒ Project
Returns a new instance of Project.
10 11 12 13 |
# File 'lib/cpp_dependency_graph/project.rb', line 10 def initialize(path) @path = path @include_resolver = IncludeToComponentResolver.new(source_components) end |
Instance Method Details
#dependencies(component) ⇒ Object
24 25 26 27 |
# File 'lib/cpp_dependency_graph/project.rb', line 24 def dependencies(component) # TODO: This is repeating the same work twice! component_for_include is called when calling external_includes external_includes(component).map { |include| @include_resolver.component_for_include(include) }.reject(&:empty?).uniq end |
#external_includes(component) ⇒ Object
29 30 31 |
# File 'lib/cpp_dependency_graph/project.rb', line 29 def external_includes(component) @include_resolver.external_includes(component) end |
#source_component(name) ⇒ Object
19 20 21 22 |
# File 'lib/cpp_dependency_graph/project.rb', line 19 def source_component(name) return SourceComponent.new('NULL') unless source_components.key?(name) source_components[name] end |
#source_components ⇒ Object
15 16 17 |
# File 'lib/cpp_dependency_graph/project.rb', line 15 def source_components @source_components ||= build_source_components end |