Class: CC::Analyzer::IncludePathsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/analyzer/include_paths_builder.rb

Defined Under Namespace

Classes: Directory

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cc_exclude_paths, cc_include_paths = []) ⇒ IncludePathsBuilder

Returns a new instance of IncludePathsBuilder.



14
15
16
17
# File 'lib/cc/analyzer/include_paths_builder.rb', line 14

def initialize(cc_exclude_paths, cc_include_paths = [])
  @cc_exclude_paths = cc_exclude_paths
  @cc_include_paths = cc_include_paths
end

Instance Attribute Details

#cc_include_pathsObject (readonly)

Returns the value of attribute cc_include_paths.



12
13
14
# File 'lib/cc/analyzer/include_paths_builder.rb', line 12

def cc_include_paths
  @cc_include_paths
end

Class Method Details

.relevant_entries(path) ⇒ Object



6
7
8
9
10
# File 'lib/cc/analyzer/include_paths_builder.rb', line 6

def self.relevant_entries(path)
  Dir.entries(path).reject do |e|
    %w(. .. .git).include?(e) || File.symlink?(File.join(path, e))
  end
end

Instance Method Details

#buildObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cc/analyzer/include_paths_builder.rb', line 19

def build
  if cc_include_paths.any?
    paths = filter_by_cc_includes
  else
    root = Directory.new(".", ignored_files)
    paths = root.included_paths
  end

  paths.each do |path|
    raise_on_unreadable_files(path)
  end
end