Class: Guard::RSpec::Inspectors::FocusedInspector
- Inherits:
-
BaseInspector
- Object
- BaseInspector
- Guard::RSpec::Inspectors::FocusedInspector
- Defined in:
- lib/guard/rspec/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 collapse
-
#focused_locations ⇒ Object
Returns the value of attribute focused_locations.
Attributes inherited from BaseInspector
Instance Method Summary collapse
- #failed(locations) ⇒ Object
-
#initialize(options = {}) ⇒ FocusedInspector
constructor
A new instance of FocusedInspector.
- #paths(paths) ⇒ Object
- #reload ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FocusedInspector
Returns a new instance of FocusedInspector.
12 13 14 15 |
# File 'lib/guard/rspec/inspectors/focused_inspector.rb', line 12 def initialize( = {}) super @focused_locations = [] end |
Instance Attribute Details
#focused_locations ⇒ Object
Returns the value of attribute focused_locations.
10 11 12 |
# File 'lib/guard/rspec/inspectors/focused_inspector.rb', line 10 def focused_locations @focused_locations end |
Instance Method Details
#failed(locations) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/guard/rspec/inspectors/focused_inspector.rb', line 25 def failed(locations) if locations.empty? @focused_locations = [] elsif focused_locations.empty? @focused_locations = locations end end |
#paths(paths) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/guard/rspec/inspectors/focused_inspector.rb', line 17 def paths(paths) if focused_locations.any? focused_locations else _clean(paths) end end |
#reload ⇒ Object
33 34 35 |
# File 'lib/guard/rspec/inspectors/focused_inspector.rb', line 33 def reload @focused_locations = [] end |