Class: CodebreakerGem::Statistic

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeStatistic

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_tableObject



20
21
22
23
24
25
26
# File 'lib/app/entities/statistic.rb', line 20

def rating_table
  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