class Guard::Test::Inspectors::KeepingInspector
Inspector
that remembers all failed paths and returns that paths in future calls to paths
method along with any new paths passed as parameter to paths
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
Guard::Test::Inspectors::BaseInspector::new
# File lib/guard/test/inspectors/keeping_inspector.rb, line 11 def initialize(options = {}) super @failed_locations = [] end
Public Instance Methods
failed(locations)
click to toggle source
# File lib/guard/test/inspectors/keeping_inspector.rb, line 20 def failed(locations) @failed_locations = locations end
paths(paths)
click to toggle source
# File lib/guard/test/inspectors/keeping_inspector.rb, line 16 def paths(paths) _with_failed_locations(_clean(paths)) end
reload()
click to toggle source
# File lib/guard/test/inspectors/keeping_inspector.rb, line 24 def reload @failed_locations = [] end
Private Instance Methods
_location_path(location)
click to toggle source
Extract file path from location
# File lib/guard/test/inspectors/keeping_inspector.rb, line 38 def _location_path(location) location.match(/^(\.\/)?(.*?)(:\d+)?$/)[2] end
_with_failed_locations(paths)
click to toggle source
Return paths + failed locations. Do not include location in result if its path is already included.
# File lib/guard/test/inspectors/keeping_inspector.rb, line 32 def _with_failed_locations(paths) failed_paths = @failed_locations.map { |l| _location_path(l) } (paths | failed_paths).uniq end