Jldrill Git C0 Coverage Information - RCov

lib/jldrill/contexts/ShowAllVocabularyContext.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/jldrill/contexts/ShowAllVocabularyContext.rb 161 111
72.05%
61.26%

Key

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.

Coverage Details

1 require 'Context/Context'
2 require 'Context/Bridge'
3 require 'Context/View'
4 
5 module JLDrill
6 
7 	class ShowAllVocabularyContext < Context::Context
8 		
9 		def initialize(viewBridge)
10 			super(viewBridge)
11 		end
12 		
13         class VocabularyTableView < Context::View
14             attr_reader :quiz, :items
15 
16             def initialize(context)
17                 super(context)
18                 @quiz = nil
19                 @items = nil
20             end
21 
22             # Destroy the window
23             def destroy
24                 # Please define in the concrete class
25             end
26 
27             # Update the items in the table
28             def update(items)
29                 @items = items
30                 # Please define the rest in the concrete class
31             end
32 
33             # Select one of the items in the table
34             def select(item)
35                 # Please define in the concrete class
36             end
37 
38             # Modify one of the items in the table
39             # This happens when an item has been edited while the table is open
40             def updateItem(item)
41                 # Please define in the concrete class
42             end
43 
44             # Add the item to the table
45             # This happens when an item has been added while the table is open
46             def addItem(item)
47                 # Please define in the concrete class
48             end
49 
50             # Remove an item from the table
51             # This happens when the item has been removed while the table is
52             # open
53             def removeItem(item)
54                 # Please define in the concrete class
55             end
56 
57             # Close the window
58             # Closing the window exits the context.
59             def close
60                 # Please define in the concrete class.
61                 # Run super() after everything is complete.
62                 @context.exit
63             end
64         end
65 
66         def createViews
67             @mainView = @viewBridge.VocabularyTableView.new(self)
68         end
69 
70         def destroyViews
71             @mainView.destroy if !@mainView.nil?
72             @mainView = nil
73         end		    
74 		
75 		def enter(parent)
76 		    super(parent)
77             if !@parent.nil? && !@parent.quiz.nil?
78                 update(@parent.quiz)
79                 if !@parent.quiz.currentProblem.nil?
80                     select(@parent.quiz.currentProblem)
81                 end
82                 @parent.quiz.publisher.subscribe(self, "load")
83                 @parent.quiz.publisher.subscribe(self, "newProblem")
84                 @parent.quiz.publisher.subscribe(self, "problemModified")
85                 @parent.quiz.publisher.subscribe(self, "itemAdded")
86                 @parent.quiz.publisher.subscribe(self, "itemDeleted")
87             end
88 		end
89 
90         def exit
91             if !@parent.nil? && !@parent.quiz.nil?
92                 @parent.quiz.publisher.unsubscribe(self, "load")
93                 @parent.quiz.publisher.unsubscribe(self, "newProblem")
94                 @parent.quiz.publisher.unsubscribe(self, "problemModified")
95                 @parent.quiz.publisher.unsubscribe(self, "itemAdded")
96                 @parent.quiz.publisher.unsubscribe(self, "itemDeleted")
97             end
98             super
99         end
100 
101         def differs?(item)
102             exists = true
103             if @parent.reference.loaded? && !item.nil?
104                 exists = @parent.reference.include?(item.to_o)
105 		    end
106 		    return !exists
107         end
108 
109         def update(quiz)
110             @mainView.update(quiz.allItems)
111         end
112 
113         def select(problem)
114             @mainView.select(problem.item)
115         end
116 
117         def updateProblem(problem)
118             @mainView.updateItem(problem.item)
119         end
120         
121         def addItem(item)
122             @mainView.addItem(item)
123         end
124 
125         def removeItem(item)
126             @mainView.removeItem(item)
127         end
128 
129 		def loadUpdated(quiz)
130             update(quiz)
131 		end
132 
133 		def newProblemUpdated(problem)
134             select(problem)
135 		end
136 
137 		def problemModifiedUpdated(problem)
138             updateProblem(problem)
139 		end
140 
141         def itemAddedUpdated(item)
142             addItem(item)
143         end
144 
145         def itemDeletedUpdated(item)
146             removeItem(item)
147         end
148 
149         def edit(item)
150             @parent.editItem(item)
151         end
152 
153         def delete(item)
154             @parent.deleteItem(item)
155         end
156 
157         def preview(item)
158             @parent.displayItem(item)
159         end
160     end
161 end

Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8