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
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(id:, type: nil, category: nil, text: nil, answers: nil, correct_answer: nil, media_type: nil, image_url: nil) ⇒ Question
rubocop:disable Metrics/ParameterLists
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/triviacrack/question.rb', line 31 def initialize(id:, type: nil, category: nil, text: nil, answers: nil, # rubocop:disable Metrics/ParameterLists 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.
20 21 22 |
# File 'lib/triviacrack/question.rb', line 20 def answers @answers end |
#category ⇒ Object (readonly)
Public: The category of the question (e.g. :arts, :geography, etc).
14 15 16 |
# File 'lib/triviacrack/question.rb', line 14 def category @category end |
#correct_answer ⇒ Object (readonly)
Public: The index of the correct answer (based on the :answers property).
23 24 25 |
# File 'lib/triviacrack/question.rb', line 23 def correct_answer @correct_answer end |
#id ⇒ Object (readonly)
Public: The unique identifier of the question.
8 9 10 |
# File 'lib/triviacrack/question.rb', line 8 def id @id end |
#image_url ⇒ Object (readonly)
Public: The URL for the image.
29 30 31 |
# File 'lib/triviacrack/question.rb', line 29 def image_url @image_url end |
#media_type ⇒ Object (readonly)
Public: The type of media used by the question (e.g. :normal, :image).
26 27 28 |
# File 'lib/triviacrack/question.rb', line 26 def media_type @media_type end |
#text ⇒ Object (readonly)
Public: The question text.
17 18 19 |
# File 'lib/triviacrack/question.rb', line 17 def text @text end |
#type ⇒ Object (readonly)
Public: The type of the question (e.g. :normal, :crown, :duel).
11 12 13 |
# File 'lib/triviacrack/question.rb', line 11 def type @type end |