Class: Codebreaker::Database
- Inherits:
-
Object
- Object
- Codebreaker::Database
- Defined in:
- lib/codebreaker/database.rb
Class Method Summary collapse
Class Method Details
.load_stats ⇒ Object
7 8 9 |
# File 'lib/codebreaker/database.rb', line 7 def load_stats load_db.sort_by! { |game| [game[:difficulty], game[:attempts_used], game[:hints_used]] } end |
.save(results) ⇒ Object
11 12 13 14 |
# File 'lib/codebreaker/database.rb', line 11 def save(results) database = load_db << results File.open(DB_PATH, 'w+') { |file| file.write(database.to_yaml) } end |