class SourceComponent
Abstracts a source directory containing source files
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/cpp_dependency_graph/source_component.rb, line 14 def initialize(path) @path = path end
Public Instance Methods
includes()
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/cpp_dependency_graph/source_component.rb, line 18 def name @name ||= File.basename(@path) end
source_files()
click to toggle source
# File lib/cpp_dependency_graph/source_component.rb, line 22 def source_files @source_files ||= parse_source_files(source_file_extensions) end
Private Instance Methods
parse_source_files(extensions)
click to toggle source
# File lib/cpp_dependency_graph/source_component.rb, line 36 def parse_source_files(extensions) glob_files(@path, extensions).map { |e| SourceFile.new(e) }.compact end