Sha256: 9b47df4725671779609206b856edd2fb7b3fcb9c6f747f74355233fab0cc1ec6

Contents?: true

Size: 543 Bytes

Versions: 9

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

module CodebreakerRuban
  class Statistic
    FILE_NAME = './lib/app/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

9 entries across 9 versions & 1 rubygems

Version Path
codebreaker_ruban-0.3.8 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.7 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.6 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.5 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.4 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.2 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.1 lib/app/entities/statistic.rb
codebreaker_ruban-0.3.0 lib/app/entities/statistic.rb
codebreaker_ruban-0.2.0 lib/app/entities/statistic.rb