Class: CommandT::Scanner::FileScanner
- Inherits:
-
CommandT::Scanner
- Object
- CommandT::Scanner
- CommandT::Scanner::FileScanner
- Defined in:
- lib/command-t/scanner/file_scanner.rb,
lib/command-t/scanner/file_scanner/git_file_scanner.rb,
lib/command-t/scanner/file_scanner/find_file_scanner.rb,
lib/command-t/scanner/file_scanner/ruby_file_scanner.rb,
lib/command-t/scanner/file_scanner/watchman_file_scanner.rb
Overview
Reads the current directory recursively for the paths to all regular files.
This is an abstract superclass; the real work is done by subclasses which obtain file listings via different strategies (for examples, see the RubyFileScanner and FindFileScanner subclasses).
Direct Known Subclasses
Defined Under Namespace
Classes: FindFileScanner, GitFileScanner, RubyFileScanner, WatchmanFileScanner
Constant Summary collapse
- FileLimitExceeded =
Class.new(::RuntimeError)
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(path = Dir.pwd, options = {}) ⇒ FileScanner
constructor
A new instance of FileScanner.
- #paths ⇒ Object
Constructor Details
#initialize(path = Dir.pwd, options = {}) ⇒ FileScanner
Returns a new instance of FileScanner.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/command-t/scanner/file_scanner.rb', line 20 def initialize(path = Dir.pwd, = {}) @paths = {} @paths_keys = [] @path = path @max_depth = [:max_depth] || 15 @max_files = [:max_files] || 100_000 @max_caches = [:max_caches] || 1 @scan_dot_directories = [:scan_dot_directories] || false @wildignore = [:wildignore] @scan_submodules = [:git_scan_submodules] || false @include_untracked = [:git_include_untracked] || false end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
18 19 20 |
# File 'lib/command-t/scanner/file_scanner.rb', line 18 def path @path end |
Instance Method Details
#flush ⇒ Object
41 42 43 |
# File 'lib/command-t/scanner/file_scanner.rb', line 41 def flush @paths = {} end |
#paths ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/command-t/scanner/file_scanner.rb', line 33 def paths @paths[@path] ||= begin ensure_cache_under_limit @prefix_len = @path.chomp('/').length + 1 paths! end end |