Sha256: b440241621220aba86dd98329d08091fe91caa0f7b753595bc51984f2524b70d

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

# Public: An object representing a Trivia Crack Question, including the list of
# available answers as well as the correct answer.
module TriviaCrack
  class Question

    # Public: The unique identifier of the question.
    attr_reader :id

    # Public: The type of the question (e.g. :normal, :crown, :duel).
    attr_reader :type

    # Public: The category of the question (e.g. :arts, :geography, etc).
    attr_reader :category

    # Public: The question text.
    attr_reader :text

    # Public: The list of possible answers to the question.
    attr_reader :answers

    # Public: The index of the correct answer (based on the :answers property).
    attr_reader :correct_answer

    # Public: The type of media used by the question (e.g. :normal, :image).
    attr_reader :media_type

    # Public: The URL for the image.
    attr_reader :image_url

    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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
triviacrack-0.6.0 lib/triviacrack/question.rb
triviacrack-0.5.1 lib/triviacrack/question.rb
triviacrack-0.5.0 lib/triviacrack/question.rb
triviacrack-0.4.0 lib/triviacrack/question.rb
triviacrack-0.3.2 lib/triviacrack/question.rb
triviacrack-0.3.0 lib/triviacrack/question.rb
triviacrack-0.2.0 lib/triviacrack/question.rb
triviacrack-0.1.0 lib/triviacrack/question.rb