Sha256: c824e9f88ad68978d8b2d79100eb1fabf53dc6531bf43889f8b7bc03960d8d5a

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

# frozen_string_literal: true

class Statistics
  class << self
    def save(stats, path)
      stats[:date] = Time.now
      YamlMapper.save(stats, path)
    end

    def output(path)
      array_stats = load(path)
      array_stats.sort_by! { |stats| [stats[:attempts_used], stats[:hints_used]] }.reverse
      array_stats
    end

    private

    def load(path)
      YamlMapper.load(path)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebreaker_rg_game-1.7 lib/codebreaker/utils/statistics.rb