class Codebreaker::Statistics

Public Class Methods

output(path) click to toggle source
# File lib/codebreaker/utils/statistics.rb, line 11
def output(path)
  array_stats = load(path)
  array_stats.sort_by! { |stats| [stats[:attempts_used], stats[:hints_used]] }.reverse
  array_stats
end
save(stats, path) click to toggle source
# File lib/codebreaker/utils/statistics.rb, line 6
def save(stats, path)
  stats[:date] = Time.now
  YamlMapper.save(stats, path)
end

Private Class Methods

load(path) click to toggle source
# File lib/codebreaker/utils/statistics.rb, line 19
def load(path)
  YamlMapper.load(path)
end