Sha256: 7825233f6c4aef6f3e605672018a3733b5e2ab64585b423a7d6990e6940b5f73

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

# Public: An object representing player statistics for a Trivia Crack game.
module TriviaCrack
  class GameStatistics
    # Public: The number of questions answered correctly.
    attr_reader :correct_answers

    # Public: The number of questions answered incorrectly.
    attr_reader :incorrect_answers

    # Public: The total number of questions answered.
    attr_reader :questions_answered

    # Public: The total number of challenges won.
    attr_reader :challenges_won

    # Public: The list of categories for which crowns have been won.
    attr_reader :crowns

    # Public: A hash of category statistics.
    attr_reader :categories

    def initialize(correct_answers: nil, incorrect_answers: nil, # rubocop:disable Metrics/ParameterLists
                   questions_answered: nil, challenges_won: nil,
                   crowns: nil, categories: nil)
      @correct_answers    = correct_answers
      @incorrect_answers  = incorrect_answers
      @questions_answered = questions_answered
      @challenges_won     = challenges_won
      @crowns             = crowns
      @categories         = categories
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
triviacrack-0.8.0 lib/triviacrack/game_statistics.rb
triviacrack-0.7.0 lib/triviacrack/game_statistics.rb