Class: Canopus::TestRunner::BoundedIgnore
- Inherits:
-
Object
- Object
- Canopus::TestRunner::BoundedIgnore
- Defined in:
- lib/canopus/test_runner/bounded_ignore.rb
Overview
Loads ignore files only for directories the bounded walker reaches.
Constant Summary collapse
- MAX_FILES =
1_000- MAX_FILE_BYTES =
256 * 1_024
- MAX_TOTAL_BYTES =
1 << 20
- MAX_LINES =
10_000- MAX_LINE_BYTES =
4_096- MAX_GIT_POINTER_BYTES =
4_096
Instance Method Summary collapse
- #ignored?(path, directory: false) ⇒ Boolean
-
#initialize(root, delegate: nil, cancelled: -> { false }) ⇒ BoundedIgnore
constructor
A new instance of BoundedIgnore.
Constructor Details
#initialize(root, delegate: nil, cancelled: -> { false }) ⇒ BoundedIgnore
Returns a new instance of BoundedIgnore.
14 15 16 17 18 19 20 21 |
# File 'lib/canopus/test_runner/bounded_ignore.rb', line 14 def initialize(root, delegate: nil, cancelled: -> { false }) @root = root @delegate = delegate @cancelled = cancelled @matcher = Thuban::IgnoreMatcher.new.add("/.canopus/trash/\n") @loaded = {} @files = @bytes = @lines = 0 end |
Instance Method Details
#ignored?(path, directory: false) ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/canopus/test_runner/bounded_ignore.rb', line 23 def ignored?(path, directory: false) path = TestRunner.normalize_path(path) return true unless path return true if @cancelled.call return safe_delegate(path, directory) if @delegate bases_for(path).each do |base| break if @cancelled.call load_base(base) end return true if @cancelled.call @matcher.ignored?(path, directory: directory) rescue ArgumentError, EncodingError true end |