Sha256: 09a89a2b3e120658a61f84231e83a8cf7c088936351c17615516dd2b879ab913
Contents?: true
Size: 357 Bytes
Versions: 4
Compression:
Stored size: 357 Bytes
Contents
module Codebreaker class StatsStorage PATH = './db/data.yml'.freeze def load File.file?(PATH) ? YAML.load_file(PATH) : [] end def add(stat) stats = load stats << stat save(stats) end private def save(stats) Pathname(PATH).dirname.mkpath File.write(PATH, stats.to_yaml) end end end
Version data entries
4 entries across 4 versions & 1 rubygems