Class: JLDrill::DisplayQuizStatusContext

Inherits:
Context::Context show all
Defined in:
lib/jldrill/contexts/DisplayQuizStatusContext.rb

Defined Under Namespace

Classes: QuizStatusView

Instance Attribute Summary

Attributes inherited from Context::Context

#mainView, #parent, #viewBridge

Instance Method Summary collapse

Methods inherited from Context::Context

#addView, #isEntered?, #onExit, #peekAtView, #setupViews

Constructor Details

#initialize(viewBridge) ⇒ DisplayQuizStatusContext

Returns a new instance of DisplayQuizStatusContext.



10
11
12
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 10

def initialize(viewBridge)
	super(viewBridge)
end

Instance Method Details

#createViewsObject



24
25
26
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 24

def createViews
    @mainView = @viewBridge.QuizStatusView.new(self)
end

#destroyViewsObject



28
29
30
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 28

def destroyViews
    @mainView = nil
end

#enter(parent) ⇒ Object



32
33
34
35
36
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 32

def enter(parent)
    super(parent)
    quizUpdated(@parent.quiz)
    @parent.quiz.subscribe(self)
end

#exitObject



38
39
40
41
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 38

def exit
          @parent.quiz.unsubscribe(self)
    super
end

#quizUpdated(quiz) ⇒ Object



43
44
45
# File 'lib/jldrill/contexts/DisplayQuizStatusContext.rb', line 43

def quizUpdated(quiz)
    @mainView.update(quiz)
end