wee 0.1.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/INSTALL +7 -0
  2. data/README +268 -0
  3. data/Rakefile +26 -0
  4. data/TODO +116 -0
  5. data/benchmark/Centrino1300/result.2000.counter.action +45 -0
  6. data/benchmark/Centrino1300/result.2000.counter.render +43 -0
  7. data/benchmark/Centrino1300/result.2000.filehandler +43 -0
  8. data/benchmark/Centrino600/result.2000.counter.action +47 -0
  9. data/benchmark/Centrino600/result.2000.counter.render +45 -0
  10. data/benchmark/Centrino600/result.2000.filehandler +43 -0
  11. data/benchmark/Makefile +48 -0
  12. data/benchmark/bench.sh +24 -0
  13. data/benchmark/counter.rb +96 -0
  14. data/benchmark/filehandler.rb +6 -0
  15. data/doc/rdoc/classes/Array.html +172 -0
  16. data/doc/rdoc/classes/Cache.html +126 -0
  17. data/doc/rdoc/classes/Cache/StorageCache.html +320 -0
  18. data/doc/rdoc/classes/Cache/Strategy.html +128 -0
  19. data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +269 -0
  20. data/doc/rdoc/classes/Cache/Strategy/LFU.html +238 -0
  21. data/doc/rdoc/classes/Cache/Strategy/LFU/Item.html +111 -0
  22. data/doc/rdoc/classes/Cache/Strategy/LRU.html +238 -0
  23. data/doc/rdoc/classes/Cache/Strategy/LRU/Item.html +111 -0
  24. data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +225 -0
  25. data/doc/rdoc/classes/Cache/Strategy/Unbounded/Item.html +111 -0
  26. data/doc/rdoc/classes/Enumerable.html +146 -0
  27. data/doc/rdoc/classes/LiteralMethod.html +196 -0
  28. data/doc/rdoc/classes/Object.html +178 -0
  29. data/doc/rdoc/classes/String.html +172 -0
  30. data/doc/rdoc/classes/Struct.html +174 -0
  31. data/doc/rdoc/classes/Wee.html +160 -0
  32. data/doc/rdoc/classes/Wee/AnswerDecoration.html +182 -0
  33. data/doc/rdoc/classes/Wee/Application.html +337 -0
  34. data/doc/rdoc/classes/Wee/Brush.html +245 -0
  35. data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +149 -0
  36. data/doc/rdoc/classes/Wee/Brush/ActionMixin.html +146 -0
  37. data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +157 -0
  38. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +210 -0
  39. data/doc/rdoc/classes/Wee/Brush/AssignMixin.html +141 -0
  40. data/doc/rdoc/classes/Wee/Brush/CallbackMixin.html +141 -0
  41. data/doc/rdoc/classes/Wee/Brush/FormTag.html +225 -0
  42. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +176 -0
  43. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +283 -0
  44. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +176 -0
  45. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +195 -0
  46. data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +149 -0
  47. data/doc/rdoc/classes/Wee/Brush/InputTag.html +172 -0
  48. data/doc/rdoc/classes/Wee/Brush/Page.html +193 -0
  49. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +267 -0
  50. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +177 -0
  51. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +154 -0
  52. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +173 -0
  53. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +146 -0
  54. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +277 -0
  55. data/doc/rdoc/classes/Wee/Brush/TableTag.html +146 -0
  56. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +229 -0
  57. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +154 -0
  58. data/doc/rdoc/classes/Wee/Callback.html +231 -0
  59. data/doc/rdoc/classes/Wee/CallbackRegistry.html +308 -0
  60. data/doc/rdoc/classes/Wee/CallbackStream.html +227 -0
  61. data/doc/rdoc/classes/Wee/Canvas.html +235 -0
  62. data/doc/rdoc/classes/Wee/Component.html +933 -0
  63. data/doc/rdoc/classes/Wee/Context.html +111 -0
  64. data/doc/rdoc/classes/Wee/Decoration.html +338 -0
  65. data/doc/rdoc/classes/Wee/Delegate.html +247 -0
  66. data/doc/rdoc/classes/Wee/ErrorPage.html +175 -0
  67. data/doc/rdoc/classes/Wee/ErrorResponse.html +180 -0
  68. data/doc/rdoc/classes/Wee/GenericResponse.html +162 -0
  69. data/doc/rdoc/classes/Wee/HtmlCanvas.html +751 -0
  70. data/doc/rdoc/classes/Wee/HtmlWriter.html +351 -0
  71. data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +180 -0
  72. data/doc/rdoc/classes/Wee/MethodCallback.html +193 -0
  73. data/doc/rdoc/classes/Wee/Page.html +111 -0
  74. data/doc/rdoc/classes/Wee/Presenter.html +521 -0
  75. data/doc/rdoc/classes/Wee/RedirectResponse.html +150 -0
  76. data/doc/rdoc/classes/Wee/RefreshResponse.html +157 -0
  77. data/doc/rdoc/classes/Wee/RenderingContext.html +111 -0
  78. data/doc/rdoc/classes/Wee/Request.html +268 -0
  79. data/doc/rdoc/classes/Wee/RequestHandler.html +336 -0
  80. data/doc/rdoc/classes/Wee/Response.html +260 -0
  81. data/doc/rdoc/classes/Wee/Session.html +469 -0
  82. data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +198 -0
  83. data/doc/rdoc/classes/Wee/Snapshot.html +211 -0
  84. data/doc/rdoc/classes/Wee/StateHolder.html +149 -0
  85. data/doc/rdoc/classes/Wee/StateRegistry.html +434 -0
  86. data/doc/rdoc/classes/Wee/StateRegistry/Snapshot.html +320 -0
  87. data/doc/rdoc/classes/Wee/StateRegistry/WithObject.html +153 -0
  88. data/doc/rdoc/classes/Wee/Utils.html +111 -0
  89. data/doc/rdoc/classes/Wee/Utils/LRUCache.html +148 -0
  90. data/doc/rdoc/classes/Wee/ValueHolder.html +220 -0
  91. data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +330 -0
  92. data/doc/rdoc/created.rid +1 -0
  93. data/doc/rdoc/files/INSTALL.html +118 -0
  94. data/doc/rdoc/files/README.html +466 -0
  95. data/doc/rdoc/files/lib/cache/cache_rb.html +101 -0
  96. data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +108 -0
  97. data/doc/rdoc/files/lib/wee/application_rb.html +112 -0
  98. data/doc/rdoc/files/lib/wee/callback_rb.html +107 -0
  99. data/doc/rdoc/files/lib/wee/component_ext_rb.html +101 -0
  100. data/doc/rdoc/files/lib/wee/component_rb.html +109 -0
  101. data/doc/rdoc/files/lib/wee/context_rb.html +101 -0
  102. data/doc/rdoc/files/lib/wee/core/callback_rb.html +115 -0
  103. data/doc/rdoc/files/lib/wee/core/component_rb.html +108 -0
  104. data/doc/rdoc/files/lib/wee/core/decoration_rb.html +133 -0
  105. data/doc/rdoc/files/lib/wee/core/presenter_rb.html +112 -0
  106. data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +113 -0
  107. data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +110 -0
  108. data/doc/rdoc/files/lib/wee/core_rb.html +131 -0
  109. data/doc/rdoc/files/lib/wee/decoration_rb.html +101 -0
  110. data/doc/rdoc/files/lib/wee/holder_rb.html +101 -0
  111. data/doc/rdoc/files/lib/wee/html_canvas_rb.html +108 -0
  112. data/doc/rdoc/files/lib/wee/html_writer_rb.html +108 -0
  113. data/doc/rdoc/files/lib/wee/idgen_rb.html +101 -0
  114. data/doc/rdoc/files/lib/wee/page_rb.html +101 -0
  115. data/doc/rdoc/files/lib/wee/presenter_rb.html +112 -0
  116. data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +101 -0
  117. data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +101 -0
  118. data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +108 -0
  119. data/doc/rdoc/files/lib/wee/rendering/html/brushes_rb.html +101 -0
  120. data/doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html +101 -0
  121. data/doc/rdoc/files/lib/wee/rendering/html/writer_rb.html +108 -0
  122. data/doc/rdoc/files/lib/wee/request_rb.html +113 -0
  123. data/doc/rdoc/files/lib/wee/requesthandler_rb.html +101 -0
  124. data/doc/rdoc/files/lib/wee/response_rb.html +108 -0
  125. data/doc/rdoc/files/lib/wee/session_rb.html +109 -0
  126. data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +101 -0
  127. data/doc/rdoc/files/lib/wee/snapshot_rb.html +107 -0
  128. data/doc/rdoc/files/lib/wee/state_registry_rb.html +110 -0
  129. data/doc/rdoc/files/lib/wee/stuff_rb.html +144 -0
  130. data/doc/rdoc/files/lib/wee/utils/cache_rb.html +108 -0
  131. data/doc/rdoc/files/lib/wee/webrick_rb.html +108 -0
  132. data/doc/rdoc/files/lib/wee_rb.html +132 -0
  133. data/doc/rdoc/fr_class_index.html +93 -0
  134. data/doc/rdoc/fr_file_index.html +51 -0
  135. data/doc/rdoc/fr_method_index.html +242 -0
  136. data/doc/rdoc/index.html +24 -0
  137. data/doc/rdoc/rdoc-style.css +208 -0
  138. data/examples/ObjectSpaceBrowser.rb +199 -0
  139. data/examples/calendar.rb +366 -0
  140. data/examples/cc.rb +94 -0
  141. data/examples/draw.rb +91 -0
  142. data/examples/example.rb +223 -0
  143. data/examples/test.rb +66 -0
  144. data/examples/window.rb +53 -0
  145. data/lib/cache/cache.rb +9 -0
  146. data/lib/wee.rb +18 -8
  147. data/lib/wee/adaptors/webrick.rb +73 -0
  148. data/lib/wee/application.rb +69 -71
  149. data/lib/wee/context.rb +2 -12
  150. data/lib/wee/core.rb +15 -0
  151. data/lib/wee/core/callback.rb +108 -0
  152. data/lib/wee/core/component.rb +314 -0
  153. data/lib/wee/core/decoration.rb +129 -0
  154. data/lib/wee/core/presenter.rb +132 -0
  155. data/lib/wee/core/snapshot.rb +21 -0
  156. data/lib/wee/core/valueholder.rb +19 -0
  157. data/lib/wee/idgen.rb +13 -0
  158. data/lib/wee/page.rb +1 -1
  159. data/lib/wee/renderer/html/brushes.rb +435 -0
  160. data/lib/wee/renderer/html/canvas.rb +148 -0
  161. data/lib/wee/{html_writer.rb → renderer/html/writer.rb} +31 -16
  162. data/lib/wee/request.rb +57 -0
  163. data/lib/wee/requesthandler.rb +77 -0
  164. data/lib/wee/response.rb +77 -0
  165. data/lib/wee/session.rb +70 -64
  166. data/lib/wee/{snapshot.rb → snapshot_ext.rb} +4 -4
  167. data/test/components/calltest.rb +16 -0
  168. data/test/components/counter.rb +17 -0
  169. data/test/components/messagebox.rb +15 -0
  170. data/test/components/page.rb +14 -0
  171. data/test/components/page_decoration.rb +7 -0
  172. data/test/stress.rb +64 -0
  173. data/test/test_component.rb +106 -0
  174. data/test/test_html_canvas.rb +25 -0
  175. data/test/test_html_writer.rb +27 -0
  176. data/test/test_request.rb +13 -0
  177. data/test/utils/cross.rb +65 -0
  178. data/test/utils/generic_plotter.rb +28 -0
  179. data/test/utils/gnuplot.rb +31 -0
  180. data/test/utils/measure_memory.rb +9 -0
  181. data/test/utils/memory_plotter.rb +10 -0
  182. data/test/utils/object_plotter.rb +10 -0
  183. data/test/utils/webrick_background.rb +31 -0
  184. data/wee.gemspec +22 -0
  185. metadata +222 -18
  186. data/lib/wee/component.rb +0 -126
  187. data/lib/wee/delegate_decoration.rb +0 -22
  188. data/lib/wee/handler_registry.rb +0 -89
  189. data/lib/wee/holder.rb +0 -14
  190. data/lib/wee/html_canvas.rb +0 -379
  191. data/lib/wee/state_registry.rb +0 -173
  192. data/lib/wee/stuff.rb +0 -29
  193. data/lib/wee/webrick.rb +0 -15
@@ -0,0 +1,308 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Wee::CallbackRegistry</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Wee::CallbackRegistry</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/wee/core/callback_rb.html">
59
+ lib/wee/core/callback.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="../Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ The callback registry is the central datastructure where all components of
86
+ a session register their callbacks.
87
+ </p>
88
+ <p>
89
+ The format of the internal datastructure is:
90
+ </p>
91
+ <pre>
92
+ @callbacks[type][callback_id] =&gt; callback
93
+ @obj_to_id_map[type][object] =&gt; [id*]
94
+ </pre>
95
+
96
+ </div>
97
+
98
+
99
+ <div id="contents-list">
100
+ <h3 class="section-bar">Contents</h3>
101
+ <ul>
102
+ <li><a href="#SEC00087">Friend methods for Wee::CallbackStream</a></li>
103
+ </ul>
104
+ </div>
105
+
106
+ <div id="method-list">
107
+ <h3 class="section-bar">Methods</h3>
108
+
109
+ <div class="name-list">
110
+ <a href="#M000151">all_of_type</a>&nbsp;&nbsp;
111
+ <a href="#M000150">get_callback_for</a>&nbsp;&nbsp;
112
+ <a href="#M000149">get_ids_for</a>&nbsp;&nbsp;
113
+ <a href="#M000147">new</a>&nbsp;&nbsp;
114
+ <a href="#M000148">register_for</a>&nbsp;&nbsp;
115
+ </div>
116
+ </div>
117
+
118
+ </div>
119
+
120
+
121
+ <!-- if includes -->
122
+
123
+ <div id="section">
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ <!-- if method_list -->
133
+ <div id="methods">
134
+ <h3 class="section-bar">Public Class methods</h3>
135
+
136
+ <div id="method-M000147" class="method-detail">
137
+ <a name="M000147"></a>
138
+
139
+ <div class="method-heading">
140
+ <a href="#M000147" class="method-signature">
141
+ <span class="method-name">new</span><span class="method-args">(id_generator)</span>
142
+ </a>
143
+ </div>
144
+
145
+ <div class="method-description">
146
+ <p><a class="source-toggle" href="#"
147
+ onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
148
+ <div class="method-source-code" id="M000147-source">
149
+ <pre>
150
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 11</span>
151
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">id_generator</span>)
152
+ <span class="ruby-ivar">@idgen</span> = <span class="ruby-identifier">id_generator</span>
153
+ <span class="ruby-ivar">@callbacks</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
154
+ <span class="ruby-ivar">@obj_to_id_map</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
155
+ <span class="ruby-keyword kw">end</span>
156
+ </pre>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <h3 class="section-bar">Public Instance methods</h3>
162
+
163
+ <div id="method-M000148" class="method-detail">
164
+ <a name="M000148"></a>
165
+
166
+ <div class="method-heading">
167
+ <a href="#M000148" class="method-signature">
168
+ <span class="method-name">register_for</span><span class="method-args">(object, type=nil, &amp;callback)</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Register <tt>callback</tt> for <tt>object</tt> under <tt>type</tt> and
175
+ return a unique callback id.
176
+ </p>
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000148-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 19</span>
182
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register_for</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">type</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">callback</span>)
183
+ <span class="ruby-identifier">c</span> = (<span class="ruby-ivar">@callbacks</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>)
184
+ <span class="ruby-identifier">o</span> = (<span class="ruby-ivar">@obj_to_id_map</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>)
185
+ <span class="ruby-identifier">cid</span> = <span class="ruby-ivar">@idgen</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
186
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;duplicate callback id&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">cid</span>)
187
+ <span class="ruby-identifier">c</span>[<span class="ruby-identifier">cid</span>] = <span class="ruby-identifier">callback</span>
188
+ (<span class="ruby-identifier">o</span>[<span class="ruby-identifier">object</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">cid</span>
189
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cid</span>
190
+ <span class="ruby-keyword kw">end</span>
191
+ </pre>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+
197
+ </div>
198
+ <div id="section">
199
+ <h2 class="section-title"><a name="SEC00087">Friend methods for Wee::CallbackStream</a></h2>
200
+ <div class="section-comment">
201
+
202
+ </div>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <!-- if method_list -->
212
+ <div id="methods">
213
+ <h3 class="section-bar">Public Instance methods</h3>
214
+
215
+ <div id="method-M000151" class="method-detail">
216
+ <a name="M000151"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000151" class="method-signature">
220
+ <span class="method-name">all_of_type</span><span class="method-args">(type=nil)</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p><a class="source-toggle" href="#"
226
+ onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
227
+ <div class="method-source-code" id="M000151-source">
228
+ <pre>
229
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 49</span>
230
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">type</span>=<span class="ruby-keyword kw">nil</span>)
231
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> = <span class="ruby-ivar">@callbacks</span>[<span class="ruby-identifier">type</span>]
232
+ <span class="ruby-identifier">c</span>
233
+ <span class="ruby-keyword kw">else</span>
234
+ <span class="ruby-identifier">raise</span>
235
+ <span class="ruby-keyword kw">end</span>
236
+ <span class="ruby-keyword kw">end</span>
237
+ </pre>
238
+ </div>
239
+ </div>
240
+ </div>
241
+
242
+ <div id="method-M000150" class="method-detail">
243
+ <a name="M000150"></a>
244
+
245
+ <div class="method-heading">
246
+ <a href="#M000150" class="method-signature">
247
+ <span class="method-name">get_callback_for</span><span class="method-args">(id, type=nil)</span>
248
+ </a>
249
+ </div>
250
+
251
+ <div class="method-description">
252
+ <p><a class="source-toggle" href="#"
253
+ onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
254
+ <div class="method-source-code" id="M000150-source">
255
+ <pre>
256
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 41</span>
257
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_callback_for</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">type</span>=<span class="ruby-keyword kw">nil</span>)
258
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> = <span class="ruby-ivar">@callbacks</span>[<span class="ruby-identifier">type</span>]
259
+ <span class="ruby-identifier">c</span>[<span class="ruby-identifier">id</span>]
260
+ <span class="ruby-keyword kw">else</span>
261
+ <span class="ruby-identifier">raise</span>
262
+ <span class="ruby-keyword kw">end</span>
263
+ <span class="ruby-keyword kw">end</span>
264
+ </pre>
265
+ </div>
266
+ </div>
267
+ </div>
268
+
269
+ <div id="method-M000149" class="method-detail">
270
+ <a name="M000149"></a>
271
+
272
+ <div class="method-heading">
273
+ <a href="#M000149" class="method-signature">
274
+ <span class="method-name">get_ids_for</span><span class="method-args">(object, type=nil)</span>
275
+ </a>
276
+ </div>
277
+
278
+ <div class="method-description">
279
+ <p><a class="source-toggle" href="#"
280
+ onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
281
+ <div class="method-source-code" id="M000149-source">
282
+ <pre>
283
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 33</span>
284
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_ids_for</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">type</span>=<span class="ruby-keyword kw">nil</span>)
285
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span> = <span class="ruby-ivar">@obj_to_id_map</span>[<span class="ruby-identifier">type</span>]
286
+ <span class="ruby-identifier">o</span>[<span class="ruby-identifier">object</span>] <span class="ruby-operator">||</span> []
287
+ <span class="ruby-keyword kw">else</span>
288
+ []
289
+ <span class="ruby-keyword kw">end</span>
290
+ <span class="ruby-keyword kw">end</span>
291
+ </pre>
292
+ </div>
293
+ </div>
294
+ </div>
295
+
296
+
297
+ </div>
298
+
299
+
300
+ </div>
301
+
302
+
303
+ <div id="validator-badges">
304
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
305
+ </div>
306
+
307
+ </body>
308
+ </html>
@@ -0,0 +1,227 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Wee::CallbackStream</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Wee::CallbackStream</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/wee/core/callback_rb.html">
59
+ lib/wee/core/callback.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="../Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ The intersection of registered callbacks and those that occured.
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ <div id="method-list">
94
+ <h3 class="section-bar">Methods</h3>
95
+
96
+ <div class="name-list">
97
+ <a href="#M000202">all_of_type</a>&nbsp;&nbsp;
98
+ <a href="#M000200">new</a>&nbsp;&nbsp;
99
+ <a href="#M000201">with_callbacks_for</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+
108
+ <div id="section">
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+ <div id="methods">
119
+ <h3 class="section-bar">Public Class methods</h3>
120
+
121
+ <div id="method-M000200" class="method-detail">
122
+ <a name="M000200"></a>
123
+
124
+ <div class="method-heading">
125
+ <a href="#M000200" class="method-signature">
126
+ <span class="method-name">new</span><span class="method-args">(callbacks, ids_and_values)</span>
127
+ </a>
128
+ </div>
129
+
130
+ <div class="method-description">
131
+ <dl>
132
+ <dt><tt>callbacks</tt></dt><dd>A <a href="CallbackRegistry.html">Wee::CallbackRegistry</a>
133
+
134
+ </dd>
135
+ <dt><tt>ids_and_values</tt></dt><dd>A hash that contains all callback ids together with their values that
136
+ occurend in a request, e.g. { id =&gt; value }.
137
+
138
+ </dd>
139
+ </dl>
140
+ <p><a class="source-toggle" href="#"
141
+ onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
142
+ <div class="method-source-code" id="M000200-source">
143
+ <pre>
144
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 72</span>
145
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">callbacks</span>, <span class="ruby-identifier">ids_and_values</span>)
146
+ <span class="ruby-ivar">@callbacks</span> = <span class="ruby-identifier">callbacks</span>
147
+ <span class="ruby-ivar">@ids_and_values</span> = <span class="ruby-identifier">ids_and_values</span>
148
+ <span class="ruby-ivar">@ids</span> = <span class="ruby-ivar">@ids_and_values</span>.<span class="ruby-identifier">keys</span>
149
+ <span class="ruby-keyword kw">end</span>
150
+ </pre>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <h3 class="section-bar">Public Instance methods</h3>
156
+
157
+ <div id="method-M000202" class="method-detail">
158
+ <a name="M000202"></a>
159
+
160
+ <div class="method-heading">
161
+ <a href="#M000202" class="method-signature">
162
+ <span class="method-name">all_of_type</span><span class="method-args">(type)</span>
163
+ </a>
164
+ </div>
165
+
166
+ <div class="method-description">
167
+ <p>
168
+ Returns a [callback, value] array of all callbacks of <tt>type</tt> for
169
+ which an id was given.
170
+ </p>
171
+ <p><a class="source-toggle" href="#"
172
+ onclick="toggleCode('M000202-source');return false;">[Source]</a></p>
173
+ <div class="method-source-code" id="M000202-source">
174
+ <pre>
175
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 89</span>
176
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">type</span>)
177
+ <span class="ruby-identifier">a</span> = []
178
+ <span class="ruby-ivar">@callbacks</span>.<span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">type</span>).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">id</span>, <span class="ruby-identifier">callback</span><span class="ruby-operator">|</span>
179
+ <span class="ruby-identifier">a</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">callback</span>, <span class="ruby-ivar">@ids_and_values</span>[<span class="ruby-identifier">id</span>]] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@ids_and_values</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">id</span>)
180
+ }
181
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">a</span>
182
+ <span class="ruby-keyword kw">end</span>
183
+ </pre>
184
+ </div>
185
+ </div>
186
+ </div>
187
+
188
+ <div id="method-M000201" class="method-detail">
189
+ <a name="M000201"></a>
190
+
191
+ <div class="method-heading">
192
+ <a href="#M000201" class="method-signature">
193
+ <span class="method-name">with_callbacks_for</span><span class="method-args">(object, type) {|@callbacks.get_callback_for(id, type), @ids_and_values[id]| ...}</span>
194
+ </a>
195
+ </div>
196
+
197
+ <div class="method-description">
198
+ <p><a class="source-toggle" href="#"
199
+ onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
200
+ <div class="method-source-code" id="M000201-source">
201
+ <pre>
202
+ <span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 78</span>
203
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_callbacks_for</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">type</span>)
204
+ <span class="ruby-identifier">matching_ids</span> = <span class="ruby-ivar">@callbacks</span>.<span class="ruby-identifier">get_ids_for</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">type</span>) <span class="ruby-operator">&amp;</span> <span class="ruby-ivar">@ids</span>
205
+ <span class="ruby-identifier">matching_ids</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span>
206
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@callbacks</span>.<span class="ruby-identifier">get_callback_for</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">type</span>), <span class="ruby-ivar">@ids_and_values</span>[<span class="ruby-identifier">id</span>]
207
+ <span class="ruby-keyword kw">end</span>
208
+ <span class="ruby-ivar">@ids</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">matching_ids</span>
209
+ <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+
216
+ </div>
217
+
218
+
219
+ </div>
220
+
221
+
222
+ <div id="validator-badges">
223
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
224
+ </div>
225
+
226
+ </body>
227
+ </html>