Method: Navo::StateFile#load

Defined in:
lib/navo/state_file.rb

#loadObject

Loads persisted state.



54
55
56
57
58
59
60
61
62
63
# File 'lib/navo/state_file.rb', line 54

def load
  @hash =
    if File.exist?(@file) && yaml = YAML.load_file(@file)
      @logger.debug "Loading state from #{@file}"
      yaml.to_hash
    else
      @logger.debug "No state file #{@file} exists; assuming empty state"
      {} # Handle empty files
    end
end