Class: CommandT::FileScanner
- Defined in:
- lib/command-t-standalone/scanner/file_scanner.rb
Overview
Reads the current directory recursively for the paths to all regular files.
Defined Under Namespace
Classes: FileLimitExceeded
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.
33 34 35 36 37 38 39 40 41 |
# File 'lib/command-t-standalone/scanner/file_scanner.rb', line 33 def initialize path = Dir.pwd, = {} @paths = {} @paths_keys = [] @path = path @max_depth = [:max_depth] || 15 @max_files = [:max_files] || 10_000 @max_caches = [:max_caches] || 1 @scan_dot_directories = [:scan_dot_directories] || false end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
31 32 33 |
# File 'lib/command-t-standalone/scanner/file_scanner.rb', line 31 def path @path end |
Instance Method Details
#flush ⇒ Object
57 58 59 |
# File 'lib/command-t-standalone/scanner/file_scanner.rb', line 57 def flush @paths = {} end |
#paths ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/command-t-standalone/scanner/file_scanner.rb', line 43 def paths return @paths[@path] if @paths.has_key?(@path) begin ensure_cache_under_limit @paths[@path] = [] @depth = 0 @files = 0 @prefix_len = @path.chomp('/').length add_paths_for_directory @path, @paths[@path] rescue FileLimitExceeded end @paths[@path] end |