class Codebreaker::YamlMapper

Public Class Methods

load(path) click to toggle source
# File lib/codebreaker/utils/yaml_mapper.rb, line 14
def load(path)
  File.file?(path) ? Psych.load(File.read(path)) : []
end
save(object, path) click to toggle source
# File lib/codebreaker/utils/yaml_mapper.rb, line 6
def save(object, path)
  stats = load(path)
  stats << object
  File.open(path, 'w') do |file|
    file.write(stats.to_yaml)
  end
end