Sha256: d0e460fa124fa6abaf695b767d84d24acab59050c43370dde2fbe03b61e993d0

Contents?: true

Size: 539 Bytes

Versions: 1

Compression:

Stored size: 539 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebreaker_ruban-0.1.0 lib/app/entities/statistic.rb