Class: Question

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_proctor/question.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Question

Returns a new instance of Question.



5
6
7
8
9
10
11
# File 'lib/ruby_proctor/question.rb', line 5

def initialize(id)
  @id = id
  @question = ''
  @answers = Array.new()
  @correct_answer = nil
  @selected_answer = -1
end

Instance Attribute Details

#answersObject

Returns the value of attribute answers.



3
4
5
# File 'lib/ruby_proctor/question.rb', line 3

def answers
  @answers
end

#correct_answerObject

Returns the value of attribute correct_answer.



3
4
5
# File 'lib/ruby_proctor/question.rb', line 3

def correct_answer
  @correct_answer
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/ruby_proctor/question.rb', line 3

def id
  @id
end

#questionObject

Returns the value of attribute question.



3
4
5
# File 'lib/ruby_proctor/question.rb', line 3

def question
  @question
end

#selected_answerObject

Returns the value of attribute selected_answer.



3
4
5
# File 'lib/ruby_proctor/question.rb', line 3

def selected_answer
  @selected_answer
end

Instance Method Details

#isCorrectObject



13
14
15
# File 'lib/ruby_proctor/question.rb', line 13

def isCorrect()
  @correct_answer == @selected_answer
end