class Mutiny::Mutants::Storage::MutantFileName
Public Instance Methods
deserialise(path)
click to toggle source
# File lib/mutiny/mutants/storage/mutant_file_name.rb, line 9 def deserialise(path) { subject: { path: path_without_index(path) }, index: index_of(path) } end
serialise(mutant)
click to toggle source
# File lib/mutiny/mutants/storage/mutant_file_name.rb, line 5 def serialise(mutant) path_with_index(mutant.subject.relative_path, mutant.index) end
Private Instance Methods
index_of(path)
click to toggle source
# File lib/mutiny/mutants/storage/mutant_file_name.rb, line 26 def index_of(path) path.match(/.*\.(\d+)\.rb/)[1].to_i end
path_with_index(path, index)
click to toggle source
# File lib/mutiny/mutants/storage/mutant_file_name.rb, line 18 def path_with_index(path, index) path.sub(/\.rb$/, ".#{index}.rb") end
path_without_index(path)
click to toggle source
# File lib/mutiny/mutants/storage/mutant_file_name.rb, line 22 def path_without_index(path) path.sub(/\.\d+\.rb$/, ".rb") end