Class: TriviaCrack::GameStatistics

Inherits:
Object
  • Object
show all
Defined in:
lib/triviacrack/game_statistics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(correct_answers: nil, incorrect_answers: nil, questions_answered: nil, challenges_won: nil, crowns: nil, categories: nil) ⇒ GameStatistics

Returns a new instance of GameStatistics.



23
24
25
26
27
28
29
30
31
32
# File 'lib/triviacrack/game_statistics.rb', line 23

def initialize(correct_answers: nil, incorrect_answers: nil,
               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

Instance Attribute Details

#categoriesObject (readonly)

Public: A hash of category statistics.



21
22
23
# File 'lib/triviacrack/game_statistics.rb', line 21

def categories
  @categories
end

#challenges_wonObject (readonly)

Public: The total number of challenges won.



15
16
17
# File 'lib/triviacrack/game_statistics.rb', line 15

def challenges_won
  @challenges_won
end

#correct_answersObject (readonly)

Public: The number of questions answered correctly.



6
7
8
# File 'lib/triviacrack/game_statistics.rb', line 6

def correct_answers
  @correct_answers
end

#crownsObject (readonly)

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



18
19
20
# File 'lib/triviacrack/game_statistics.rb', line 18

def crowns
  @crowns
end

#incorrect_answersObject (readonly)

Public: The number of questions answered incorrectly.



9
10
11
# File 'lib/triviacrack/game_statistics.rb', line 9

def incorrect_answers
  @incorrect_answers
end

#questions_answeredObject (readonly)

Public: The total number of questions answered.



12
13
14
# File 'lib/triviacrack/game_statistics.rb', line 12

def questions_answered
  @questions_answered
end