Class: CodebreakerGem::Statistic
- Inherits:
-
Object
- Object
- CodebreakerGem::Statistic
- Defined in:
- lib/app/entities/statistic.rb
Constant Summary collapse
- DB_DIR =
'database'
- STATISTIC_FILE_NAME =
'statistic'
- YML_FORMAT =
'.yml'
- STATISTIC_YML =
DB_DIR + '/' + STATISTIC_FILE_NAME + YML_FORMAT
Instance Method Summary collapse
-
#initialize ⇒ Statistic
constructor
A new instance of Statistic.
- #rating_table ⇒ Object
- #save(player, score) ⇒ Object
Constructor Details
#initialize ⇒ Statistic
Returns a new instance of Statistic.
11 12 13 |
# File 'lib/app/entities/statistic.rb', line 11 def initialize @table = I18n.t(:table) end |
Instance Method Details
#rating_table ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/app/entities/statistic.rb', line 20 def table = Terminal::Table.new table.title = @table[:title] table.headings = @table[:headings] table.rows = table_rows table end |
#save(player, score) ⇒ Object
15 16 17 18 |
# File 'lib/app/entities/statistic.rb', line 15 def save(player, score) new_record = record(player, score) save_to_file(new_record) end |