Class: Mutant::Result::SessionFiles Private
- Inherits:
-
Object
- Object
- Mutant::Result::SessionFiles
- Defined in:
- lib/mutant/result/session_files.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The session files of past runs in .mutant/results/
Constant Summary collapse
- DIRECTORY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.mutant/results'- PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Sessions this version writes gzip compressed, and those earlier versions wrote as plain JSON. The plain ones are listed first, each kind oldest first, as the earlier versions wrote them before this one wrote any.
'*.json{,.gz}'- KEEP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Sessions a run keeps, and
mutant session gckeeps by default 100
Instance Method Summary collapse
-
#paths ⇒ Array<Pathname>
private
The session files, oldest first.
-
#prune(keep) ⇒ Array<Pathname>
private
Delete all but the most recent sessions.
Instance Method Details
#paths ⇒ Array<Pathname>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The session files, oldest first
23 24 25 26 27 28 29 |
# File 'lib/mutant/result/session_files.rb', line 23 def paths dir = world.pathname.new(DIRECTORY) return EMPTY_ARRAY unless dir.directory? dir.glob(PATTERN) end |
#prune(keep) ⇒ Array<Pathname>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Delete all but the most recent sessions
A session written alongside this one by a concurrent run may have been deleted by that run already.
40 41 42 43 44 45 46 47 48 |
# File 'lib/mutant/result/session_files.rb', line 40 def prune(keep) excess = paths.reverse.drop(keep) excess.each do |path| path.delete rescue Errno::ENOENT nil end end |