# frozen_string_literal: true module Codebreaker class Statistics class << self def save(stats, path) stats[:date] = Time.now YamlMapper.save(stats, path) end def output(path) array_stats = load(path) array_stats.sort_by! { |stats| [stats[:attempts_used], stats[:hints_used]] }.reverse array_stats end private def load(path) YamlMapper.load(path) end end end end