Class: Codebreaker::Entities::Statistics
- Inherits:
-
Object
- Object
- Codebreaker::Entities::Statistics
- Defined in:
- lib/codebreaker/entities/statistics.rb
Instance Method Summary collapse
Instance Method Details
#stats(list) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/codebreaker/entities/statistics.rb', line 4 def stats(list) difficulties = list.group_by { |score| score[:difficulty] } %i[hard medium easy].reduce([]) do |sorted_difficulties, difficulty_name| if difficulties[difficulty_name] sorted_difficulties + stats_sort(difficulties[difficulty_name]) else sorted_difficulties end end end |