class Kozo::Backends::Local

Public Instance Methods

==(other) click to toggle source
# File lib/kozo/backends/local.rb, line 23
def ==(other)
  directory == other.directory
end
state() click to toggle source
# File lib/kozo/backends/local.rb, line 8
def state
  Kozo.logger.debug "Reading local state in #{file}"

  File.write(file, {}.to_json) unless File.exist?(file)

  JSON.parse(File.read(file), symbolize_names: true)
rescue JSON::ParserError => e
  Kozo.logger.fatal "Could not read state file: #{e.message}"
end
state=(value) click to toggle source
# File lib/kozo/backends/local.rb, line 18
def state=(value)
  Kozo.logger.debug "Writing local state in #{file}"
  File.write(file, value.to_json)
end

Private Instance Methods

file() click to toggle source
# File lib/kozo/backends/local.rb, line 29
def file
  @file ||= File.join(directory, "kozo.kzstate")
end