class Koine::TestRunner::Adapters::LastCommand::Storage

Public Class Methods

new(file_path: '.cache/koine/last-test-command.cache') click to toggle source
# File lib/koine/test_runner/adapters/last_command.rb, line 21
def initialize(file_path: '.cache/koine/last-test-command.cache')
  @file_path = file_path
end

Public Instance Methods

retrieve() click to toggle source
# File lib/koine/test_runner/adapters/last_command.rb, line 25
def retrieve
  if File.exist?(@file_path)
    File.read(@file_path).strip
  end
end
store(value) click to toggle source
# File lib/koine/test_runner/adapters/last_command.rb, line 31
def store(value)
  folder = File.dirname(@file_path)

  unless File.exist?(folder)
    FileUtils.mkdir_p(folder)
  end

  File.open(@file_path, 'w') { |f| f.puts(value) }
end