Class: TriviaCrack::Question
- Inherits:
-
Object
- Object
- TriviaCrack::Question
- Defined in:
- lib/triviacrack/question.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
readonly
Public: The list of possible answers to the question.
-
#category ⇒ Object
readonly
Public: The category of the question (e.g. :arts, :geography, etc).
-
#correct_answer ⇒ Object
readonly
Public: The index of the correct answer (based on the :answers property).
-
#id ⇒ Object
readonly
Public: The unique identifier of the question.
-
#image_url ⇒ Object
readonly
Public: The URL for the image.
-
#media_type ⇒ Object
readonly
Public: The type of media used by the question (e.g. :normal, :image).
-
#text ⇒ Object
readonly
Public: The question text.
-
#type ⇒ Object
readonly
Public: The type of the question (e.g. :normal, :crown, :duel).
Instance Method Summary collapse
-
#initialize(id:, type: nil, category: nil, text: nil, answers: nil, correct_answer: nil, media_type: nil, image_url: nil) ⇒ Question
constructor
A new instance of Question.
Constructor Details
#initialize(id:, type: nil, category: nil, text: nil, answers: nil, correct_answer: nil, media_type: nil, image_url: nil) ⇒ Question
Returns a new instance of Question.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/triviacrack/question.rb', line 30 def initialize(id:, type: nil, category: nil, text: nil, answers: nil, correct_answer: nil, media_type: nil, image_url: nil) @id = id @type = type @category = category @text = text @answers = answers @correct_answer = correct_answer @media_type = media_type @image_url = image_url end |
Instance Attribute Details
#answers ⇒ Object (readonly)
Public: The list of possible answers to the question.
19 20 21 |
# File 'lib/triviacrack/question.rb', line 19 def answers @answers end |
#category ⇒ Object (readonly)
Public: The category of the question (e.g. :arts, :geography, etc).
13 14 15 |
# File 'lib/triviacrack/question.rb', line 13 def category @category end |
#correct_answer ⇒ Object (readonly)
Public: The index of the correct answer (based on the :answers property).
22 23 24 |
# File 'lib/triviacrack/question.rb', line 22 def correct_answer @correct_answer end |
#id ⇒ Object (readonly)
Public: The unique identifier of the question.
7 8 9 |
# File 'lib/triviacrack/question.rb', line 7 def id @id end |
#image_url ⇒ Object (readonly)
Public: The URL for the image.
28 29 30 |
# File 'lib/triviacrack/question.rb', line 28 def image_url @image_url end |
#media_type ⇒ Object (readonly)
Public: The type of media used by the question (e.g. :normal, :image).
25 26 27 |
# File 'lib/triviacrack/question.rb', line 25 def media_type @media_type end |
#text ⇒ Object (readonly)
Public: The question text.
16 17 18 |
# File 'lib/triviacrack/question.rb', line 16 def text @text end |
#type ⇒ Object (readonly)
Public: The type of the question (e.g. :normal, :crown, :duel).
10 11 12 |
# File 'lib/triviacrack/question.rb', line 10 def type @type end |