Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/contexts/PromptContext.rb | 61 | 43 | 55.74%
|
41.86%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 require 'Context/Context' |
2 require 'Context/Bridge' |
3 require 'Context/View' |
4 |
5 module JLDrill |
6 |
7 class PromptContext < Context::Context |
8 |
9 attr_reader :cancel, :yes, :no, :response, :title, :message |
10 |
11 def initialize(viewBridge) |
12 super(viewBridge) |
13 @cancel = "cancel" |
14 @yes = "yes" |
15 @no = "no" |
16 @response = @cancel |
17 @title = "Prompt" |
18 @message = "Please replace this with a question for the user." |
19 end |
20 |
21 class PromptView < Context::View |
22 attr_reader :response, :title, :message |
23 |
24 def initialize(context, title, message) |
25 super(context) |
26 @title = title |
27 @message = message |
28 @response = @context.cancel |
29 end |
30 |
31 # Destroys the prompt window |
32 def destroy |
33 # Please override in the concrete class |
34 end |
35 |
36 # Display the dialog and get the input from the user |
37 def run |
38 # Please override in the concrete class |
39 end |
40 end |
41 |
42 # The concrete class should override this method |
43 def createViews |
44 # Please set the title and message member variables |
45 # and call super() in the concrete class |
46 @mainView = @viewBridge.PromptView.new(self, @title, @message) |
47 end |
48 |
49 def destroyViews |
50 @mainView.destroy if !@mainView.nil? |
51 @mainView = nil |
52 end |
53 |
54 def enter(parent) |
55 super(parent) |
56 @response = @mainView.run |
57 self.exit |
58 return @response |
59 end |
60 end |
61 end |
Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8