Sha256: 75c2dda7d7ad502f47fe19296aa33cd2292af4437e7977527365af7e266a59ba

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

require 'jldrill/contexts/DisplayProblemContext'

module JLDrill::Test

    class ProblemView < JLDrill::DisplayProblemContext::ProblemView

        attr_reader :newProblem, :answerShown

        def initialize(context)
            super(context)
            @newProblem = false
            @answerShown = false
        end

        # A new problem has been added
        def newProblem(problem)
            super(problem)

            @newProblem = true
            @answerShown = false
        end	

        # The current problem has changed and needs updating
        def updateProblem(problem)
            super(problem)

            @newProblem = false
            # When the problem is updated it goes back to only showing
            # the question
            @answerShown = false
        end

        # Show the answer to the problem
        def showAnswer
            @newProblem = false
            @answerShown = true
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 lib/jldrill/views/test/ProblemView.rb