Sha256: 856259472f176ca93c585076291af48139284428246c720b0eb2ca60939b60b6
Contents?: true
Size: 578 Bytes
Versions: 2
Compression:
Stored size: 578 Bytes
Contents
# frozen_string_literal: true module Codebreaker class Statistics class << self def save(stats) YamlMapper.save(stats) end def output stats = load sort(stats) hash_stats = {} stats.each_index do |index| hash_stats[index] = stats[index].to_s end hash_stats.to_a end private def sort(array_stats) array_stats.sort_by! { |stats| [stats[:attempts_used], stats[:hints_used]] }.reverse end def load YamlMapper.load end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
codebreaker_rg_game-1.1 | lib/codebreaker/entities/statistics.rb |
codebreaker_rg_game-1.0 | lib/codebreaker/entities/statistics.rb |