Module: NewSuperCodebreaker2021::ShowContent

Included in:
Game
Defined in:
lib/new_super_codebreaker_2021/show_content.rb

Instance Method Summary collapse

Instance Method Details

#show_stats(file) ⇒ Object



3
4
5
6
7
8
# File 'lib/new_super_codebreaker_2021/show_content.rb', line 3

def show_stats(file)
  data = YAML.load_file(file) || []
  data.sort_by! { |game| [-game.difficulty, game.attempts_used, game.hints_used] }
rescue Errno::ENOENT
  []
end