Class: JLDrill::PromptContext
- Inherits:
-
Context::Context
- Object
- Context::Context
- JLDrill::PromptContext
- Defined in:
- lib/jldrill/contexts/PromptContext.rb
Direct Known Subclasses
Defined Under Namespace
Classes: PromptView
Instance Attribute Summary collapse
-
#cancel ⇒ Object
readonly
Returns the value of attribute cancel.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#no ⇒ Object
readonly
Returns the value of attribute no.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#yes ⇒ Object
readonly
Returns the value of attribute yes.
Attributes inherited from Context::Context
#mainView, #parent, #viewBridge
Instance Method Summary collapse
-
#createViews ⇒ Object
The concrete class should override this method.
- #destroyViews ⇒ Object
- #enter(parent) ⇒ Object
-
#initialize(viewBridge) ⇒ PromptContext
constructor
A new instance of PromptContext.
Methods inherited from Context::Context
#addView, #exit, #isEntered?, #onExit, #peekAtView, #setupViews
Constructor Details
#initialize(viewBridge) ⇒ PromptContext
Returns a new instance of PromptContext.
12 13 14 15 16 17 18 19 20 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 12 def initialize(viewBridge) super(viewBridge) @cancel = "cancel" @yes = "yes" @no = "no" @response = @cancel @title = "Prompt" @message = "Please replace this with a question for the user." end |
Instance Attribute Details
#cancel ⇒ Object (readonly)
Returns the value of attribute cancel.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def cancel @cancel end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def @message end |
#no ⇒ Object (readonly)
Returns the value of attribute no.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def no @no end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def response @response end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def title @title end |
#yes ⇒ Object (readonly)
Returns the value of attribute yes.
10 11 12 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 10 def yes @yes end |
Instance Method Details
#createViews ⇒ Object
The concrete class should override this method
44 45 46 47 48 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 44 def createViews # Please set the title and message member variables # and call super() in the concrete class @mainView = @viewBridge.PromptView.new(self, @title, @message) end |
#destroyViews ⇒ Object
50 51 52 53 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 50 def destroyViews @mainView.destroy if !@mainView.nil? @mainView = nil end |
#enter(parent) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/jldrill/contexts/PromptContext.rb', line 55 def enter(parent) super(parent) @response = @mainView.run self.exit return @response end |