Class: CC::Analyzer::PathFilter
- Inherits:
-
Object
- Object
- CC::Analyzer::PathFilter
- Defined in:
- lib/cc/analyzer/path_filter.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
-
#initialize(paths) ⇒ PathFilter
constructor
A new instance of PathFilter.
- #reject_globs(globs) ⇒ Object
- #reject_paths(ignore_paths) ⇒ Object
- #reject_symlinks ⇒ Object
- #reject_unreadable_paths ⇒ Object
- #select_readable_files ⇒ Object
Constructor Details
#initialize(paths) ⇒ PathFilter
Returns a new instance of PathFilter.
6 7 8 |
# File 'lib/cc/analyzer/path_filter.rb', line 6 def initialize(paths) @paths = paths end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
4 5 6 |
# File 'lib/cc/analyzer/path_filter.rb', line 4 def paths @paths end |
Instance Method Details
#reject_globs(globs) ⇒ Object
30 31 32 33 34 |
# File 'lib/cc/analyzer/path_filter.rb', line 30 def reject_globs(globs) patterns = PathPatterns.new(globs) @paths = paths.reject { |path| patterns.match?(pathpatterns.match?(path)) } self end |
#reject_paths(ignore_paths) ⇒ Object
15 16 17 18 |
# File 'lib/cc/analyzer/path_filter.rb', line 15 def reject_paths(ignore_paths) @paths = paths - ignore_paths self end |
#reject_symlinks ⇒ Object
25 26 27 28 |
# File 'lib/cc/analyzer/path_filter.rb', line 25 def reject_symlinks @paths = paths.reject { |path| File.symlink?(path) } self end |
#reject_unreadable_paths ⇒ Object
10 11 12 13 |
# File 'lib/cc/analyzer/path_filter.rb', line 10 def reject_unreadable_paths @paths = paths - unreadable_path_entries self end |
#select_readable_files ⇒ Object
20 21 22 23 |
# File 'lib/cc/analyzer/path_filter.rb', line 20 def select_readable_files @paths = paths.select { |path| File.exist?(path) && FileUtils.readable_by_all?(path) } self end |