Class: JLDrill::SetOptionsContext
- Inherits:
-
Context::Context
- Object
- Context::Context
- JLDrill::SetOptionsContext
- Defined in:
- lib/jldrill/contexts/SetOptionsContext.rb
Defined Under Namespace
Classes: OptionsView
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#quiz ⇒ Object
readonly
Returns the value of attribute quiz.
Attributes inherited from Context::Context
#mainView, #parent, #viewBridge
Instance Method Summary collapse
- #createViews ⇒ Object
- #destroyViews ⇒ Object
- #enter(parent) ⇒ Object
- #exit ⇒ Object
- #getDictionaryFilename ⇒ Object
- #hasQuiz?(parent) ⇒ Boolean
-
#initialize(viewBridge) ⇒ SetOptionsContext
constructor
A new instance of SetOptionsContext.
Methods inherited from Context::Context
#addView, #isEntered?, #onExit, #peekAtView, #setupViews
Constructor Details
#initialize(viewBridge) ⇒ SetOptionsContext
Returns a new instance of SetOptionsContext.
13 14 15 16 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 13 def initialize(viewBridge) super(viewBridge) @quiz = nil end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
11 12 13 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 11 def filename @filename end |
#quiz ⇒ Object (readonly)
Returns the value of attribute quiz.
11 12 13 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 11 def quiz @quiz end |
Instance Method Details
#createViews ⇒ Object
67 68 69 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 67 def createViews @mainView = @viewBridge.OptionsView.new(self) end |
#destroyViews ⇒ Object
71 72 73 74 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 71 def destroyViews @mainView.destroy @mainView = nil end |
#enter(parent) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 89 def enter(parent) if hasQuiz?(parent) super(parent) @quiz = parent.quiz @mainView.update(@quiz.) @mainView.run end end |
#exit ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 98 def exit if @mainView. @quiz..assign(@mainView.) @quiz.strategy.reschedule end super end |
#getDictionaryFilename ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 81 def getDictionaryFilename context = GetFilenameContext.new(@viewBridge, GetFilenameContext::OPEN) filename = context.enter(self) if !filename.nil? @mainView.setDictionaryFilename(filename) end end |
#hasQuiz?(parent) ⇒ Boolean
76 77 78 79 |
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 76 def hasQuiz?(parent) !parent.nil? && parent.class.public_method_defined?(:quiz) && !parent.quiz.nil? end |