Class: JLDrill::Test::ProblemView

Inherits:
DisplayProblemContext::ProblemView show all
Defined in:
lib/jldrill/views/test/ProblemView.rb

Instance Attribute Summary collapse

Attributes inherited from DisplayProblemContext::ProblemView

#itemHints

Attributes inherited from Context::View

#context

Instance Method Summary collapse

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

#answerShownObject (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

#showAnswerObject

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