Class: SourceComponent
Overview
Abstracts a source directory containing source files
Instance Attribute Summary collapse
Instance Method Summary
collapse
#fetch_all_dirs, #glob_files
Methods included from Config
#source_file_extensions
Constructor Details
Returns a new instance of SourceComponent.
14
15
16
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 14
def initialize(path)
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
12
13
14
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 12
def path
@path
end
|
Instance Method Details
#includes ⇒ Object
26
27
28
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 26
def includes
@includes ||= source_files.flat_map(&:includes).uniq.map { |include| File.basename(include) }
end
|
#loc ⇒ Object
30
31
32
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 30
def loc
@loc ||= source_files.inject(0) { |total_loc, file| total_loc + file.loc }
end
|
#name ⇒ Object
18
19
20
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 18
def name
@name ||= File.basename(@path)
end
|
#source_files ⇒ Object
22
23
24
|
# File 'lib/cpp_dependency_graph/source_component.rb', line 22
def source_files
@source_files ||= parse_source_files(source_file_extensions)
end
|