class Codebreaker::Statistics
Constants
- COLUMN_NUMBERS
Public Instance Methods
winners(base)
click to toggle source
# File lib/entities/statistics.rb, line 15 def winners(base) data = multi_sort(base) to_table(data) end
Private Instance Methods
multi_sort(items)
click to toggle source
# File lib/entities/statistics.rb, line 38 def multi_sort(items) items.sort_by { |player| [player.difficulty, player.attempts_used, player.hints_used] } end
to_table(data)
click to toggle source
# File lib/entities/statistics.rb, line 22 def to_table(data) rows = [] data.map do |i| row = [] row << i.name row << i.difficulty row << i.attempts_left row << i.attempts_total row << i.have_hints row << i.hints_total row << i.date rows << row end rows end