Class: JLDrill::Test::ProblemView
- Inherits:
-
DisplayProblemContext::ProblemView
- Object
- Context::View
- DisplayProblemContext::ProblemView
- JLDrill::Test::ProblemView
- Defined in:
- lib/jldrill/views/test/ProblemView.rb
Instance Attribute Summary collapse
-
#answerShown ⇒ Object
readonly
Returns the value of attribute answerShown.
-
#newProblem(problem) ⇒ Object
readonly
A new problem has been added.
Attributes inherited from DisplayProblemContext::ProblemView
Attributes inherited from Context::View
Instance Method Summary collapse
-
#initialize(context) ⇒ ProblemView
constructor
A new instance of ProblemView.
-
#showAnswer ⇒ Object
Show the answer to the problem.
-
#updateProblem(problem) ⇒ Object
The current problem has changed and needs updating.
Methods inherited from DisplayProblemContext::ProblemView
#removingViewFrom, #showBusy, #viewAddedTo
Methods inherited from Context::View
#addView, #getWidget, #removeView, #removingViewFrom, #viewAddedTo
Constructor Details
#initialize(context) ⇒ ProblemView
Returns a new instance of ProblemView.
10 11 12 13 14 |
# File 'lib/jldrill/views/test/ProblemView.rb', line 10 def initialize(context) super(context) @newProblem = false @answerShown = false end |
Instance Attribute Details
#answerShown ⇒ Object (readonly)
Returns the value of attribute answerShown.
8 9 10 |
# File 'lib/jldrill/views/test/ProblemView.rb', line 8 def answerShown @answerShown end |
#newProblem(problem) ⇒ Object (readonly)
A new problem has been added
17 18 19 |
# File 'lib/jldrill/views/test/ProblemView.rb', line 17 def newProblem @newProblem end |
Instance Method Details
#showAnswer ⇒ Object
Show the answer to the problem
35 36 37 38 |
# File 'lib/jldrill/views/test/ProblemView.rb', line 35 def showAnswer @newProblem = false @answerShown = true end |
#updateProblem(problem) ⇒ Object
The current problem has changed and needs updating
25 26 27 28 29 30 31 32 |
# File 'lib/jldrill/views/test/ProblemView.rb', line 25 def updateProblem(problem) super(problem) @newProblem = false # When the problem is updated it goes back to only showing # the question @answerShown = false end |