Class: Guard::Test::Inspectors::FocusedInspector

Inherits:
BaseInspector show all
Defined in:
lib/guard/test/inspectors/focused_inspector.rb

Overview

Inspector that focuses on set of paths if any of them is failing. Returns only that set of paths on all future calls to #paths until they all pass

Instance Attribute Summary

Attributes inherited from BaseInspector

#options, #test_paths

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FocusedInspector

Returns a new instance of FocusedInspector.



11
12
13
14
# File 'lib/guard/test/inspectors/focused_inspector.rb', line 11

def initialize(options = {})
  super
  @focused_locations = []
end

Instance Method Details

#failed(locations) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/guard/test/inspectors/focused_inspector.rb', line 24

def failed(locations)
  if locations.empty?
    @focused_locations = []
  else
    @focused_locations = locations if @focused_locations.empty?
  end
end

#paths(paths) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/guard/test/inspectors/focused_inspector.rb', line 16

def paths(paths)
  if @focused_locations.any?
    @focused_locations
  else
    _clean(paths)
  end
end

#reloadObject



32
33
34
# File 'lib/guard/test/inspectors/focused_inspector.rb', line 32

def reload
  @focused_locations = []
end