# frozen_string_literal: true module CodebreakerRuban class Statistic FILE_NAME = './lib/store/store.yml' class << self def show_stats data = Storage.load_storage if data.empty? Message.statistic_empty else sort_data(data).each do |value| Message.show_stats(value) end end end private def sort_data(items) items.sort_by { |item| [item[:difficulty], item[:attempts_used], item[:hints_used]] } end end end end