wee 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,193 @@
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::MethodCallback</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::MethodCallback</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/wee/callback_rb.html">
59
+ lib/wee/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="Callback.html">
69
+ Wee::Callback
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
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000181">invoke</a>&nbsp;&nbsp;
92
+ <a href="#M000180">new</a>&nbsp;&nbsp;
93
+ </div>
94
+ </div>
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+
101
+ <div id="section">
102
+
103
+
104
+
105
+
106
+
107
+ <div id="attribute-list">
108
+ <h3 class="section-bar">Attributes</h3>
109
+
110
+ <div class="name-list">
111
+ <table>
112
+ <tr class="top-aligned-row context-row">
113
+ <td class="context-item-name">meth</td>
114
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
115
+ <td class="context-item-desc"></td>
116
+ </tr>
117
+ </table>
118
+ </div>
119
+ </div>
120
+
121
+
122
+
123
+ <!-- if method_list -->
124
+ <div id="methods">
125
+ <h3 class="section-bar">Public Class methods</h3>
126
+
127
+ <div id="method-M000180" class="method-detail">
128
+ <a name="M000180"></a>
129
+
130
+ <div class="method-heading">
131
+ <a href="#M000180" class="method-signature">
132
+ <span class="method-name">new</span><span class="method-args">(obj, meth, *values)</span>
133
+ </a>
134
+ </div>
135
+
136
+ <div class="method-description">
137
+ <p><a class="source-toggle" href="#"
138
+ onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
139
+ <div class="method-source-code" id="M000180-source">
140
+ <pre>
141
+ <span class="ruby-comment cmt"># File lib/wee/callback.rb, line 30</span>
142
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">values</span>)
143
+ <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">values</span>)
144
+ <span class="ruby-ivar">@meth</span> = <span class="ruby-identifier">meth</span>
145
+ <span class="ruby-keyword kw">end</span>
146
+ </pre>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ <h3 class="section-bar">Public Instance methods</h3>
152
+
153
+ <div id="method-M000181" class="method-detail">
154
+ <a name="M000181"></a>
155
+
156
+ <div class="method-heading">
157
+ <a href="#M000181" class="method-signature">
158
+ <span class="method-name">invoke</span><span class="method-args">()</span>
159
+ </a>
160
+ </div>
161
+
162
+ <div class="method-description">
163
+ <p><a class="source-toggle" href="#"
164
+ onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
165
+ <div class="method-source-code" id="M000181-source">
166
+ <pre>
167
+ <span class="ruby-comment cmt"># File lib/wee/callback.rb, line 35</span>
168
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke</span>
169
+ <span class="ruby-identifier">m</span> = <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">method</span>(<span class="ruby-ivar">@meth</span>)
170
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
171
+ <span class="ruby-identifier">m</span>.<span class="ruby-identifier">call</span>
172
+ <span class="ruby-keyword kw">else</span>
173
+ <span class="ruby-identifier">m</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-ivar">@values</span>)
174
+ <span class="ruby-keyword kw">end</span>
175
+ <span class="ruby-keyword kw">end</span>
176
+ </pre>
177
+ </div>
178
+ </div>
179
+ </div>
180
+
181
+
182
+ </div>
183
+
184
+
185
+ </div>
186
+
187
+
188
+ <div id="validator-badges">
189
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
190
+ </div>
191
+
192
+ </body>
193
+ </html>
@@ -0,0 +1,111 @@
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::Page</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::Page</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/wee/page_rb.html">
59
+ lib/wee/page.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
+ Struct.new(:snapshot, :callbacks);
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+
91
+ <div id="section">
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <!-- if method_list -->
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <div id="validator-badges">
107
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
+ </div>
109
+
110
+ </body>
111
+ </html>
@@ -0,0 +1,521 @@
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::Presenter</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::Presenter</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/wee/core/presenter_rb.html">
59
+ lib/wee/core/presenter.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
+ <a href="Presenter.html">Wee::Presenter</a> is the superclass of all
86
+ classes that want to participate in rendering and callback-processing. <a
87
+ href="Component.html">Wee::Component</a> and <a
88
+ href="Decoration.html">Wee::Decoration</a> are it&#8217;s two most
89
+ important subclasses.
90
+ </p>
91
+
92
+ </div>
93
+
94
+
95
+ <div id="contents-list">
96
+ <h3 class="section-bar">Contents</h3>
97
+ <ul>
98
+ <li><a href="#SEC00079">Render</a></li>
99
+ <li><a href="#SEC00080">Callback</a></li>
100
+ <li><a href="#SEC00081">Backtrack</a></li>
101
+ <li><a href="#SEC00082">Session</a></li>
102
+ </ul>
103
+ </div>
104
+
105
+ <div id="method-list">
106
+ <h3 class="section-bar">Methods</h3>
107
+
108
+ <div class="name-list">
109
+ <a href="#M000188">backtrack_state</a>&nbsp;&nbsp;
110
+ <a href="#M000182">do_render</a>&nbsp;&nbsp;
111
+ <a href="#M000187">process_callbacks</a>&nbsp;&nbsp;
112
+ <a href="#M000184">r</a>&nbsp;&nbsp;
113
+ <a href="#M000181">render</a>&nbsp;&nbsp;
114
+ <a href="#M000183">renderer</a>&nbsp;&nbsp;
115
+ <a href="#M000186">renderer_class</a>&nbsp;&nbsp;
116
+ <a href="#M000189">session</a>&nbsp;&nbsp;
117
+ <a href="#M000185">with_renderer_for</a>&nbsp;&nbsp;
118
+ </div>
119
+ </div>
120
+
121
+ </div>
122
+
123
+
124
+ <!-- if includes -->
125
+
126
+ <div id="section">
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ <!-- if method_list -->
136
+ <div id="section">
137
+ <h2 class="section-title"><a name="SEC00079">Render</a></h2>
138
+ <div class="section-comment">
139
+
140
+ </div>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <!-- if method_list -->
150
+ <div id="methods">
151
+ <h3 class="section-bar">Public Instance methods</h3>
152
+
153
+ <div id="method-M000182" class="method-detail">
154
+ <a name="M000182"></a>
155
+
156
+ <div class="method-heading">
157
+ <a href="#M000182" class="method-signature">
158
+ <span class="method-name">do_render</span><span class="method-args">(rendering_context)</span>
159
+ </a>
160
+ </div>
161
+
162
+ <div class="method-description">
163
+ <p>
164
+ Render the presenter in the given rendering context. <b>DO NOT</b>
165
+ overwrite this method, unless you know exactly what you&#8217;re doing!
166
+ </p>
167
+ <p>
168
+ Creates a new renderer object of the class returned by method <a
169
+ href="Presenter.html#M000186">renderer_class</a>, makes this the current
170
+ renderer, then invokes method <a href="Presenter.html#M000181">render</a>.
171
+ </p>
172
+ <dl>
173
+ <dt><tt>rendering_context</tt></dt><dd>An object of class <a href="RenderingContext.html">RenderingContext</a>
174
+
175
+ </dd>
176
+ </dl>
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000182-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 33</span>
182
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_render</span>(<span class="ruby-identifier">rendering_context</span>)
183
+ <span class="ruby-identifier">with_renderer_for</span>(<span class="ruby-identifier">rendering_context</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">render</span>() <span class="ruby-keyword kw">end</span>
184
+ <span class="ruby-keyword kw">end</span>
185
+ </pre>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <div id="method-M000181" class="method-detail">
191
+ <a name="M000181"></a>
192
+
193
+ <div class="method-heading">
194
+ <a href="#M000181" class="method-signature">
195
+ <span class="method-name">render</span><span class="method-args">()</span>
196
+ </a>
197
+ </div>
198
+
199
+ <div class="method-description">
200
+ <p>
201
+ This method renders the content of the presenter.
202
+ </p>
203
+ <p>
204
+ <b>OVERWRITE</b> this method in your own presenter classes to implement the
205
+ view. By default this method does nothing!
206
+ </p>
207
+ <p>
208
+ Use the current renderer as returned by <a
209
+ href="Presenter.html#M000183">renderer</a> or it&#8217;s short-cut <a
210
+ href="Presenter.html#M000184">r</a>.
211
+ </p>
212
+ <p><a class="source-toggle" href="#"
213
+ onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
214
+ <div class="method-source-code" id="M000181-source">
215
+ <pre>
216
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 20</span>
217
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
218
+ <span class="ruby-keyword kw">end</span>
219
+ </pre>
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ <h3 class="section-bar">Protected Instance methods</h3>
225
+
226
+ <div id="method-M000184" class="method-detail">
227
+ <a name="M000184"></a>
228
+
229
+ <div class="method-heading">
230
+ <a href="#M000184" class="method-signature">
231
+ <span class="method-name">r</span><span class="method-args">()</span>
232
+ </a>
233
+ </div>
234
+
235
+ <div class="method-description">
236
+ <p>
237
+ Short cut for <a href="Presenter.html#M000183">renderer</a>.
238
+ </p>
239
+ <p><a class="source-toggle" href="#"
240
+ onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
241
+ <div class="method-source-code" id="M000184-source">
242
+ <pre>
243
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 43</span>
244
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">r</span>() <span class="ruby-ivar">@renderer</span> <span class="ruby-keyword kw">end</span>
245
+ </pre>
246
+ </div>
247
+ </div>
248
+ </div>
249
+
250
+ <div id="method-M000183" class="method-detail">
251
+ <a name="M000183"></a>
252
+
253
+ <div class="method-heading">
254
+ <a href="#M000183" class="method-signature">
255
+ <span class="method-name">renderer</span><span class="method-args">()</span>
256
+ </a>
257
+ </div>
258
+
259
+ <div class="method-description">
260
+ <p>
261
+ Returns the current renderer object for use by the render methods.
262
+ </p>
263
+ <p><a class="source-toggle" href="#"
264
+ onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
265
+ <div class="method-source-code" id="M000183-source">
266
+ <pre>
267
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 40</span>
268
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">renderer</span>() <span class="ruby-ivar">@renderer</span> <span class="ruby-keyword kw">end</span>
269
+ </pre>
270
+ </div>
271
+ </div>
272
+ </div>
273
+
274
+ <div id="method-M000186" class="method-detail">
275
+ <a name="M000186"></a>
276
+
277
+ <div class="method-heading">
278
+ <a href="#M000186" class="method-signature">
279
+ <span class="method-name">renderer_class</span><span class="method-args">()</span>
280
+ </a>
281
+ </div>
282
+
283
+ <div class="method-description">
284
+ <p>
285
+ Returns the class used as renderer for this presenter. Overwrite this
286
+ method if you want to use a different renderer.
287
+ </p>
288
+ <p><a class="source-toggle" href="#"
289
+ onclick="toggleCode('M000186-source');return false;">[Source]</a></p>
290
+ <div class="method-source-code" id="M000186-source">
291
+ <pre>
292
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 66</span>
293
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">renderer_class</span>
294
+ <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultRenderer</span>
295
+ <span class="ruby-keyword kw">end</span>
296
+ </pre>
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <div id="method-M000185" class="method-detail">
302
+ <a name="M000185"></a>
303
+
304
+ <div class="method-heading">
305
+ <a href="#M000185" class="method-signature">
306
+ <span class="method-name">with_renderer_for</span><span class="method-args">(rendering_context) {|| ...}</span>
307
+ </a>
308
+ </div>
309
+
310
+ <div class="method-description">
311
+ <p>
312
+ Creates a new renderer object of the class returned by method <a
313
+ href="Presenter.html#M000186">renderer_class</a>, then makes this the
314
+ current renderer for the time the block it yields to executes. Finally, it
315
+ restores the current renderer to the former one and closes the newly
316
+ created renderer.
317
+ </p>
318
+ <p><a class="source-toggle" href="#"
319
+ onclick="toggleCode('M000185-source');return false;">[Source]</a></p>
320
+ <div class="method-source-code" id="M000185-source">
321
+ <pre>
322
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 50</span>
323
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_renderer_for</span>(<span class="ruby-identifier">rendering_context</span>)
324
+ <span class="ruby-identifier">renderer</span> = <span class="ruby-identifier">renderer_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rendering_context</span>)
325
+ <span class="ruby-identifier">renderer</span>.<span class="ruby-identifier">current_component</span> = <span class="ruby-keyword kw">self</span>
326
+ <span class="ruby-identifier">old_renderer</span> = <span class="ruby-ivar">@renderer</span>
327
+ <span class="ruby-keyword kw">begin</span>
328
+ <span class="ruby-ivar">@renderer</span> = <span class="ruby-identifier">renderer</span>
329
+ <span class="ruby-keyword kw">yield</span>
330
+ <span class="ruby-keyword kw">ensure</span>
331
+ <span class="ruby-ivar">@renderer</span> = <span class="ruby-identifier">old_renderer</span>
332
+ <span class="ruby-identifier">renderer</span>.<span class="ruby-identifier">close</span> <span class="ruby-comment cmt"># write outstanding brushes to the document</span>
333
+ <span class="ruby-keyword kw">end</span>
334
+ <span class="ruby-keyword kw">end</span>
335
+ </pre>
336
+ </div>
337
+ </div>
338
+ </div>
339
+
340
+
341
+ </div>
342
+ <div id="section">
343
+ <h2 class="section-title"><a name="SEC00080">Callback</a></h2>
344
+ <div class="section-comment">
345
+
346
+ </div>
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+ <!-- if method_list -->
356
+ <div id="methods">
357
+ <h3 class="section-bar">Public Instance methods</h3>
358
+
359
+ <div id="method-M000187" class="method-detail">
360
+ <a name="M000187"></a>
361
+
362
+ <div class="method-heading">
363
+ <a href="#M000187" class="method-signature">
364
+ <span class="method-name">process_callbacks</span><span class="method-args">(callback_stream) {|| ...}</span>
365
+ </a>
366
+ </div>
367
+
368
+ <div class="method-description">
369
+ <p>
370
+ Process all callbacks specified for this presenter.
371
+ </p>
372
+ <p>
373
+ At first, this method invokes all input callbacks of this presenter, then
374
+ it calls the block if one was given (used by subclasses). Finally, the
375
+ action callback is invoked (there&#8217;s only one per request).
376
+ </p>
377
+ <p>
378
+ NOTE: Input callbacks should never call other components!
379
+ </p>
380
+ <dl>
381
+ <dt><tt>callback_stream</tt></dt><dd>An object of class <a href="CallbackStream.html">CallbackStream</a>
382
+
383
+ </dd>
384
+ </dl>
385
+ <p><a class="source-toggle" href="#"
386
+ onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
387
+ <div class="method-source-code" id="M000187-source">
388
+ <pre>
389
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 87</span>
390
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callback_stream</span>) <span class="ruby-comment cmt"># :yields:</span>
391
+ <span class="ruby-comment cmt"># invoke input callbacks</span>
392
+ <span class="ruby-identifier">callback_stream</span>.<span class="ruby-identifier">with_callbacks_for</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:input</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
393
+ <span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>)
394
+ }
395
+
396
+ <span class="ruby-comment cmt"># enable subclasses to add behaviour, e.g. a Component class will invoke</span>
397
+ <span class="ruby-comment cmt"># process_callbacks_chain for each child in the block.</span>
398
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
399
+
400
+ <span class="ruby-comment cmt"># invoke action callback. only the first action callback is invoked.</span>
401
+ <span class="ruby-identifier">callback_stream</span>.<span class="ruby-identifier">with_callbacks_for</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:action</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
402
+ <span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>
403
+ <span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_back_to_session</span>
404
+ }
405
+ <span class="ruby-keyword kw">end</span>
406
+ </pre>
407
+ </div>
408
+ </div>
409
+ </div>
410
+
411
+
412
+ </div>
413
+ <div id="section">
414
+ <h2 class="section-title"><a name="SEC00081">Backtrack</a></h2>
415
+ <div class="section-comment">
416
+
417
+ </div>
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+ <!-- if method_list -->
427
+ <div id="methods">
428
+ <h3 class="section-bar">Public Instance methods</h3>
429
+
430
+ <div id="method-M000188" class="method-detail">
431
+ <a name="M000188"></a>
432
+
433
+ <div class="method-heading">
434
+ <a href="#M000188" class="method-signature">
435
+ <span class="method-name">backtrack_state</span><span class="method-args">(snapshot)</span>
436
+ </a>
437
+ </div>
438
+
439
+ <div class="method-description">
440
+ <p>
441
+ Dummy implementation. See <a
442
+ href="Component.html#M000177">Component#backtrack_state</a> for more
443
+ information.
444
+ </p>
445
+ <dl>
446
+ <dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
447
+
448
+ </dd>
449
+ </dl>
450
+ <p><a class="source-toggle" href="#"
451
+ onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
452
+ <div class="method-source-code" id="M000188-source">
453
+ <pre>
454
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 115</span>
455
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
456
+ <span class="ruby-keyword kw">end</span>
457
+ </pre>
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+
463
+ </div>
464
+ <div id="section">
465
+ <h2 class="section-title"><a name="SEC00082">Session</a></h2>
466
+ <div class="section-comment">
467
+
468
+ </div>
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+ <!-- if method_list -->
478
+ <div id="methods">
479
+ <h3 class="section-bar">Public Instance methods</h3>
480
+
481
+ <div id="method-M000189" class="method-detail">
482
+ <a name="M000189"></a>
483
+
484
+ <div class="method-heading">
485
+ <a href="#M000189" class="method-signature">
486
+ <span class="method-name">session</span><span class="method-args">()</span>
487
+ </a>
488
+ </div>
489
+
490
+ <div class="method-description">
491
+ <p>
492
+ Returns the current session. A presenter (or component) has always an
493
+ associated session. The returned object is of class <a
494
+ href="Session.html">Wee::Session</a> or a subclass thereof.
495
+ </p>
496
+ <p><a class="source-toggle" href="#"
497
+ onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
498
+ <div class="method-source-code" id="M000189-source">
499
+ <pre>
500
+ <span class="ruby-comment cmt"># File lib/wee/core/presenter.rb, line 128</span>
501
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>
502
+ <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Session</span>.<span class="ruby-identifier">current</span>
503
+ <span class="ruby-keyword kw">end</span>
504
+ </pre>
505
+ </div>
506
+ </div>
507
+ </div>
508
+
509
+
510
+ </div>
511
+
512
+
513
+ </div>
514
+
515
+
516
+ <div id="validator-badges">
517
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
518
+ </div>
519
+
520
+ </body>
521
+ </html>