Class: Question
- Inherits:
-
Object
- Object
- Question
- Defined in:
- lib/ruby_proctor/question.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
Returns the value of attribute answers.
-
#correct_answer ⇒ Object
Returns the value of attribute correct_answer.
-
#id ⇒ Object
Returns the value of attribute id.
-
#question ⇒ Object
Returns the value of attribute question.
-
#selected_answer ⇒ Object
Returns the value of attribute selected_answer.
Instance Method Summary collapse
-
#initialize(id) ⇒ Question
constructor
A new instance of Question.
- #isCorrect ⇒ Object
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
#answers ⇒ Object
Returns the value of attribute answers.
3 4 5 |
# File 'lib/ruby_proctor/question.rb', line 3 def answers @answers end |
#correct_answer ⇒ Object
Returns the value of attribute correct_answer.
3 4 5 |
# File 'lib/ruby_proctor/question.rb', line 3 def correct_answer @correct_answer end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ruby_proctor/question.rb', line 3 def id @id end |
#question ⇒ Object
Returns the value of attribute question.
3 4 5 |
# File 'lib/ruby_proctor/question.rb', line 3 def question @question end |
#selected_answer ⇒ Object
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
#isCorrect ⇒ Object
13 14 15 |
# File 'lib/ruby_proctor/question.rb', line 13 def isCorrect() @correct_answer == @selected_answer end |