Class: TriviaCrack::CategoryStatistics

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category: nil, correct: nil, incorrect: nil, worst: nil) ⇒ CategoryStatistics

Returns a new instance of CategoryStatistics.



19
20
21
22
23
24
# File 'lib/triviacrack/category_statistics.rb', line 19

def initialize(category: nil, correct: nil, incorrect: nil, worst: nil)
  @category  = category
  @correct   = correct
  @incorrect = incorrect
  @worst     = worst
end

Instance Attribute Details

#categoryObject (readonly)

Public: The category for these statistics (:arts, :geography, etc).



7
8
9
# File 'lib/triviacrack/category_statistics.rb', line 7

def category
  @category
end

#correctObject (readonly)

Public: The number of questions answered correctly for this category.



10
11
12
# File 'lib/triviacrack/category_statistics.rb', line 10

def correct
  @correct
end

#incorrectObject (readonly)

Public: The number of questions answered incorrectly for this category.



13
14
15
# File 'lib/triviacrack/category_statistics.rb', line 13

def incorrect
  @incorrect
end

#worstObject (readonly)

Public: Boolean indicating whether this is the worst category for the player.



17
18
19
# File 'lib/triviacrack/category_statistics.rb', line 17

def worst
  @worst
end