Class: Codebreaker::Statistics

Inherits:
Object
  • Object
show all
Defined in:
lib/codebreaker/utils/statistics.rb

Class Method Summary collapse

Class Method Details

.output(path) ⇒ Object



11
12
13
14
15
# 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) ⇒ Object



6
7
8
9
# File 'lib/codebreaker/utils/statistics.rb', line 6

def save(stats, path)
  stats[:date] = Time.now
  YamlMapper.save(stats, path)
end