wee 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/TODO +31 -0
  2. data/benchmark.rb +37 -0
  3. data/demo.ru +11 -0
  4. data/doc/rdoc/classes/Array.html +22 -26
  5. data/doc/rdoc/classes/Hash.html +22 -26
  6. data/doc/rdoc/classes/Object.html +21 -26
  7. data/doc/rdoc/classes/String.html +19 -87
  8. data/doc/rdoc/classes/Struct.html +22 -26
  9. data/doc/rdoc/classes/Wee.html +75 -206
  10. data/doc/rdoc/classes/Wee/AnswerDecoration.html +35 -66
  11. data/doc/rdoc/classes/Wee/AnswerDecoration/Answer.html +28 -46
  12. data/doc/rdoc/classes/Wee/Application.html +63 -114
  13. data/doc/rdoc/classes/Wee/Application/SessionCache.html +30 -44
  14. data/doc/rdoc/classes/Wee/Brush.html +52 -101
  15. data/doc/rdoc/classes/Wee/Brush/ActionInputTag.html +29 -51
  16. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +44 -101
  17. data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +43 -76
  18. data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +29 -46
  19. data/doc/rdoc/classes/Wee/Brush/FormTag.html +48 -110
  20. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +30 -42
  21. data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +37 -58
  22. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +93 -210
  23. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +38 -63
  24. data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +29 -45
  25. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +35 -52
  26. data/doc/rdoc/classes/Wee/Brush/ImageTag.html +28 -61
  27. data/doc/rdoc/classes/Wee/Brush/InputTag.html +34 -107
  28. data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +28 -54
  29. data/doc/rdoc/classes/Wee/Brush/Page.html +39 -73
  30. data/doc/rdoc/classes/Wee/Brush/PasswordInputTag.html +29 -45
  31. data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +54 -98
  32. data/doc/rdoc/classes/Wee/Brush/RadioGroup.html +46 -84
  33. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +87 -187
  34. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +29 -56
  35. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +29 -45
  36. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +28 -55
  37. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +28 -55
  38. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +56 -113
  39. data/doc/rdoc/classes/Wee/Brush/TableTag.html +27 -58
  40. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +48 -140
  41. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +29 -45
  42. data/doc/rdoc/classes/Wee/CallAnswerMixin.html +51 -79
  43. data/doc/rdoc/classes/Wee/CallbackMixin.html +44 -77
  44. data/doc/rdoc/classes/Wee/CallbackRegistry.html +69 -125
  45. data/doc/rdoc/classes/Wee/Callbacks.html +43 -82
  46. data/doc/rdoc/classes/Wee/Component.html +142 -292
  47. data/doc/rdoc/classes/Wee/Decoration.html +85 -141
  48. data/doc/rdoc/classes/Wee/DecorationMixin.html +111 -118
  49. data/doc/rdoc/classes/Wee/Delegate.html +72 -115
  50. data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +37 -54
  51. data/doc/rdoc/classes/Wee/ErrorResponse.html +31 -48
  52. data/doc/rdoc/classes/Wee/FormDecoration.html +32 -46
  53. data/doc/rdoc/classes/Wee/GenericResponse.html +30 -50
  54. data/doc/rdoc/classes/Wee/HtmlCanvas.html +209 -562
  55. data/doc/rdoc/classes/Wee/HtmlDocument.html +51 -91
  56. data/doc/rdoc/classes/Wee/HtmlWriter.html +76 -156
  57. data/doc/rdoc/classes/Wee/IdGenerator.html +28 -44
  58. data/doc/rdoc/classes/Wee/IdGenerator/Secure.html +53 -95
  59. data/doc/rdoc/classes/Wee/IdGenerator/Sequential.html +37 -63
  60. data/doc/rdoc/classes/Wee/JQuery.html +36 -64
  61. data/doc/rdoc/classes/Wee/LRUCache.html +94 -189
  62. data/doc/rdoc/classes/Wee/LRUCache/Item.html +30 -42
  63. data/doc/rdoc/classes/Wee/ObjectSnapshotMixin.html +37 -54
  64. data/doc/rdoc/classes/Wee/PageDecoration.html +48 -79
  65. data/doc/rdoc/classes/Wee/Presenter.html +86 -143
  66. data/doc/rdoc/classes/Wee/RedirectResponse.html +31 -49
  67. data/doc/rdoc/classes/Wee/RefreshResponse.html +34 -48
  68. data/doc/rdoc/classes/Wee/Renderer.html +56 -125
  69. data/doc/rdoc/classes/Wee/Request.html +57 -115
  70. data/doc/rdoc/classes/Wee/Response.html +24 -26
  71. data/doc/rdoc/classes/Wee/Session.html +137 -292
  72. data/doc/rdoc/classes/Wee/Session/AbortCallbackProcessing.html +29 -46
  73. data/doc/rdoc/classes/Wee/Session/MutexSerializer.html +29 -42
  74. data/doc/rdoc/classes/Wee/Session/Page.html +22 -21
  75. data/doc/rdoc/classes/Wee/Session/ThreadSerializer.html +36 -60
  76. data/doc/rdoc/classes/Wee/State.html +57 -105
  77. data/doc/rdoc/classes/Wee/State/Snapshot.html +22 -21
  78. data/doc/rdoc/classes/Wee/State/SnapshotIVars.html +22 -21
  79. data/doc/rdoc/classes/Wee/StructSnapshotMixin.html +37 -54
  80. data/doc/rdoc/classes/Wee/WrapperDecoration.html +42 -68
  81. data/doc/rdoc/created.rid +1 -1
  82. data/doc/rdoc/files/README_rdoc.html +26 -17
  83. data/doc/rdoc/files/lib/wee/application_rb.html +25 -19
  84. data/doc/rdoc/files/lib/wee/call_answer_rb.html +23 -12
  85. data/doc/rdoc/files/lib/wee/callback_rb.html +23 -12
  86. data/doc/rdoc/files/lib/wee/component_rb.html +25 -19
  87. data/doc/rdoc/files/lib/wee/decoration_rb.html +23 -15
  88. data/doc/rdoc/files/lib/wee/html_brushes_rb.html +23 -12
  89. data/doc/rdoc/files/lib/wee/html_canvas_rb.html +23 -15
  90. data/doc/rdoc/files/lib/wee/html_document_rb.html +23 -15
  91. data/doc/rdoc/files/lib/wee/html_writer_rb.html +23 -15
  92. data/doc/rdoc/files/lib/wee/id_generator_rb.html +24 -17
  93. data/doc/rdoc/files/lib/wee/jquery/jquery_rb.html +23 -12
  94. data/doc/rdoc/files/lib/wee/jquery_rb.html +23 -15
  95. data/doc/rdoc/files/lib/wee/lru_cache_rb.html +23 -12
  96. data/doc/rdoc/files/lib/wee/presenter_rb.html +23 -12
  97. data/doc/rdoc/files/lib/wee/renderer_rb.html +23 -12
  98. data/doc/rdoc/files/lib/wee/request_rb.html +23 -15
  99. data/doc/rdoc/files/lib/wee/response_rb.html +24 -17
  100. data/doc/rdoc/files/lib/wee/session_rb.html +26 -21
  101. data/doc/rdoc/files/lib/wee/state_rb.html +23 -12
  102. data/doc/rdoc/files/lib/wee_rb.html +37 -47
  103. data/doc/rdoc/fr_class_index.html +12 -86
  104. data/doc/rdoc/fr_file_index.html +12 -30
  105. data/doc/rdoc/fr_method_index.html +242 -473
  106. data/doc/rdoc/index.html +8 -5
  107. data/doc/rdoc/rdoc-style.css +119 -210
  108. data/examples/ObjectSpaceBrowser.rb +4 -4
  109. data/examples/TODO +21 -0
  110. data/examples/ajax.rb +6 -4
  111. data/examples/blog.rb +42 -0
  112. data/examples/demo.rb +5 -3
  113. data/examples/demo/calculator.rb +3 -3
  114. data/examples/demo/calendar.rb +4 -4
  115. data/examples/demo/counter.rb +2 -2
  116. data/examples/demo/editable_counter.rb +2 -2
  117. data/examples/demo/example.rb +25 -16
  118. data/examples/demo/window.rb +10 -3
  119. data/examples/hw2.rb +17 -0
  120. data/examples/recipe/description.rb +170 -0
  121. data/examples/recipe/migrations/001_create_recipes.rb +13 -0
  122. data/examples/recipe/model.rb +27 -0
  123. data/examples/recipe/models/recipe.rb +18 -0
  124. data/examples/recipe/recipe_editor.rb +28 -0
  125. data/lib/wee.rb +1 -7
  126. data/lib/wee/component.rb +37 -74
  127. data/lib/wee/decoration.rb +16 -15
  128. data/lib/wee/html_brushes.rb +16 -17
  129. data/lib/wee/presenter.rb +2 -1
  130. data/lib/wee/response.rb +4 -4
  131. data/lib/wee/session.rb +2 -2
  132. data/lib/wee/state.rb +2 -2
  133. data/test/t.rb +67 -0
  134. data/wee.gemspec +1 -1
  135. metadata +157 -167
@@ -1,9 +1,12 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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
+
3
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
7
  <head>
5
- <title>Class: Wee::Callbacks [RDoc Documentation]</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <title>Class: Wee::Callbacks</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
7
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
8
11
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
9
12
  <script type="text/javascript">
@@ -22,7 +25,7 @@
22
25
  return false;
23
26
 
24
27
  elemStyle = elem.style;
25
-
28
+
26
29
  if ( elemStyle.display != "block" ) {
27
30
  elemStyle.display = "block"
28
31
  } else {
@@ -31,10 +34,10 @@
31
34
 
32
35
  return true;
33
36
  }
34
-
37
+
35
38
  // Make codeblocks hidden by default
36
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
37
-
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
38
41
  // ]]>
39
42
  </script>
40
43
 
@@ -42,6 +45,7 @@
42
45
  <body>
43
46
 
44
47
 
48
+
45
49
  <div id="classHeader">
46
50
  <table class="header-table">
47
51
  <tr class="top-aligned-row">
@@ -51,119 +55,94 @@
51
55
  <tr class="top-aligned-row">
52
56
  <td><strong>In:</strong></td>
53
57
  <td>
54
-
55
-
56
58
  <a href="../../files/lib/wee/callback_rb.html">
57
-
58
59
  lib/wee/callback.rb
59
-
60
60
  </a>
61
-
62
-
63
61
  <br />
64
-
65
62
  </td>
66
63
  </tr>
67
64
 
68
-
69
65
  <tr class="top-aligned-row">
70
66
  <td><strong>Parent:</strong></td>
71
67
  <td>
72
-
73
68
  <a href="../Object.html">
74
-
75
69
  Object
76
-
77
70
  </a>
78
-
79
71
  </td>
80
72
  </tr>
81
-
82
73
  </table>
83
74
  </div>
84
75
  <!-- banner header -->
85
76
 
86
77
  <div id="bodyContent">
87
78
 
79
+
80
+
88
81
  <div id="contextContent">
89
82
 
90
- </div>
91
83
 
92
84
 
85
+ </div>
86
+
93
87
  <div id="method-list">
94
88
  <h3 class="section-bar">Methods</h3>
95
89
 
96
90
  <div class="name-list">
97
-
98
- <a href="#M000221">new</a>&nbsp;&nbsp;
99
-
100
- <a href="#M000222">unregister</a>&nbsp;&nbsp;
101
-
102
- <a href="#M000223">with_triggered</a>&nbsp;&nbsp;
103
-
91
+ <a href="#M000117">new</a>&nbsp;&nbsp;
92
+ <a href="#M000118">unregister</a>&nbsp;&nbsp;
93
+ <a href="#M000119">with_triggered</a>&nbsp;&nbsp;
104
94
  </div>
105
95
  </div>
106
96
 
107
97
  </div>
108
98
 
99
+
109
100
  <!-- if includes -->
110
101
 
111
102
  <div id="section">
112
103
 
113
104
 
114
105
 
106
+
107
+
115
108
  <div id="attribute-list">
116
109
  <h3 class="section-bar">Attributes</h3>
117
110
 
118
111
  <div class="name-list">
119
112
  <table>
120
-
121
113
  <tr class="top-aligned-row context-row">
122
114
  <td class="context-item-name">action_callbacks</td>
123
-
124
115
  <td class="context-item-value">&nbsp;[R]&nbsp;</td>
125
-
126
116
  <td class="context-item-desc"></td>
127
117
  </tr>
128
-
129
118
  <tr class="top-aligned-row context-row">
130
119
  <td class="context-item-name">input_callbacks</td>
131
-
132
120
  <td class="context-item-value">&nbsp;[R]&nbsp;</td>
133
-
134
121
  <td class="context-item-desc"></td>
135
122
  </tr>
136
-
137
123
  </table>
138
124
  </div>
139
125
  </div>
126
+
140
127
 
141
128
 
142
129
  <!-- if method_list -->
143
-
144
130
  <div id="methods">
145
-
146
131
  <h3 class="section-bar">Public Class methods</h3>
147
132
 
148
-
149
- <div id="method-M000221" class="method-detail">
150
- <a name="M000221"></a>
133
+ <div id="method-M000117" class="method-detail">
134
+ <a name="M000117"></a>
151
135
 
152
136
  <div class="method-heading">
153
-
154
- <a href="#M000221" class="method-signature">
155
-
137
+ <a href="#M000117" class="method-signature">
156
138
  <span class="method-name">new</span><span class="method-args">()</span>
157
-
158
139
  </a>
159
-
160
140
  </div>
161
-
141
+
162
142
  <div class="method-description">
163
-
164
143
  <p><a class="source-toggle" href="#"
165
- onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
166
- <div class="method-source-code" id="M000221-source">
144
+ onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
145
+ <div class="method-source-code" id="M000117-source">
167
146
  <pre>
168
147
  <span class="ruby-comment cmt"># File lib/wee/callback.rb, line 67</span>
169
148
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
@@ -172,32 +151,24 @@
172
151
  <span class="ruby-keyword kw">end</span>
173
152
  </pre>
174
153
  </div>
175
-
176
154
  </div>
177
155
  </div>
178
156
 
179
-
180
157
  <h3 class="section-bar">Public Instance methods</h3>
181
158
 
182
-
183
- <div id="method-M000222" class="method-detail">
184
- <a name="M000222"></a>
159
+ <div id="method-M000118" class="method-detail">
160
+ <a name="M000118"></a>
185
161
 
186
162
  <div class="method-heading">
187
-
188
- <a href="#M000222" class="method-signature">
189
-
163
+ <a href="#M000118" class="method-signature">
190
164
  <span class="method-name">unregister</span><span class="method-args">(object)</span>
191
-
192
165
  </a>
193
-
194
166
  </div>
195
-
167
+
196
168
  <div class="method-description">
197
-
198
169
  <p><a class="source-toggle" href="#"
199
- onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
200
- <div class="method-source-code" id="M000222-source">
170
+ onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
171
+ <div class="method-source-code" id="M000118-source">
201
172
  <pre>
202
173
  <span class="ruby-comment cmt"># File lib/wee/callback.rb, line 72</span>
203
174
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">object</span>)
@@ -206,29 +177,22 @@
206
177
  <span class="ruby-keyword kw">end</span>
207
178
  </pre>
208
179
  </div>
209
-
210
180
  </div>
211
181
  </div>
212
182
 
213
-
214
- <div id="method-M000223" class="method-detail">
215
- <a name="M000223"></a>
183
+ <div id="method-M000119" class="method-detail">
184
+ <a name="M000119"></a>
216
185
 
217
186
  <div class="method-heading">
218
-
219
- <a href="#M000223" class="method-signature">
220
-
187
+ <a href="#M000119" class="method-signature">
221
188
  <span class="method-name">with_triggered</span><span class="method-args">(ids_and_values) {|| ...}</span>
222
-
223
189
  </a>
224
-
225
190
  </div>
226
-
191
+
227
192
  <div class="method-description">
228
-
229
193
  <p><a class="source-toggle" href="#"
230
- onclick="toggleCode('M000223-source');return false;">[Source]</a></p>
231
- <div class="method-source-code" id="M000223-source">
194
+ onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
195
+ <div class="method-source-code" id="M000119-source">
232
196
  <pre>
233
197
  <span class="ruby-comment cmt"># File lib/wee/callback.rb, line 77</span>
234
198
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_triggered</span>(<span class="ruby-identifier">ids_and_values</span>)
@@ -241,22 +205,19 @@
241
205
  <span class="ruby-keyword kw">end</span>
242
206
  </pre>
243
207
  </div>
244
-
245
208
  </div>
246
209
  </div>
247
210
 
248
211
 
249
-
250
212
  </div>
251
213
 
252
214
 
253
-
254
-
255
215
  </div>
256
216
 
217
+
257
218
  <div id="validator-badges">
258
219
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
259
220
  </div>
260
221
 
261
222
  </body>
262
- </html>
223
+ </html>
@@ -1,9 +1,12 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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
+
3
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
7
  <head>
5
- <title>Class: Wee::Component [RDoc Documentation]</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <title>Class: Wee::Component</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
7
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
8
11
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
9
12
  <script type="text/javascript">
@@ -22,7 +25,7 @@
22
25
  return false;
23
26
 
24
27
  elemStyle = elem.style;
25
-
28
+
26
29
  if ( elemStyle.display != "block" ) {
27
30
  elemStyle.display = "block"
28
31
  } else {
@@ -31,10 +34,10 @@
31
34
 
32
35
  return true;
33
36
  }
34
-
37
+
35
38
  // Make codeblocks hidden by default
36
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
37
-
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
38
41
  // ]]>
39
42
  </script>
40
43
 
@@ -42,6 +45,7 @@
42
45
  <body>
43
46
 
44
47
 
48
+
45
49
  <div id="classHeader">
46
50
  <table class="header-table">
47
51
  <tr class="top-aligned-row">
@@ -51,211 +55,177 @@
51
55
  <tr class="top-aligned-row">
52
56
  <td><strong>In:</strong></td>
53
57
  <td>
54
-
55
-
56
58
  <a href="../../files/lib/wee/component_rb.html">
57
-
58
59
  lib/wee/component.rb
59
-
60
60
  </a>
61
-
62
-
63
61
  <br />
64
-
65
62
  </td>
66
63
  </tr>
67
64
 
68
-
69
65
  <tr class="top-aligned-row">
70
66
  <td><strong>Parent:</strong></td>
71
67
  <td>
72
-
73
68
  <a href="Presenter.html">
74
-
75
- Wee::Presenter
76
-
69
+ Presenter
77
70
  </a>
78
-
79
71
  </td>
80
72
  </tr>
81
-
82
73
  </table>
83
74
  </div>
84
75
  <!-- banner header -->
85
76
 
86
77
  <div id="bodyContent">
87
78
 
79
+
80
+
88
81
  <div id="contextContent">
89
82
 
90
83
  <div id="description">
91
84
  <p>
92
85
  The base class of all components. You should at least overwrite method <a
93
- href="Component.html#M000045">render</a> in your own subclasses.
86
+ href="Component.html#M000216">render</a> in your own subclasses.
94
87
  </p>
95
88
 
96
89
  </div>
97
90
 
98
- </div>
99
91
 
92
+ </div>
100
93
 
101
94
  <div id="method-list">
102
95
  <h3 class="section-bar">Methods</h3>
103
96
 
104
97
  <div class="name-list">
105
-
106
- <a href="#M000051">add_child</a>&nbsp;&nbsp;
107
-
108
- <a href="#M000047">backtrack</a>&nbsp;&nbsp;
109
-
110
- <a href="#M000049">backtrack_children</a>&nbsp;&nbsp;
111
-
112
- <a href="#M000048">backtrack_decoration</a>&nbsp;&nbsp;
113
-
114
- <a href="#M000050">each_child</a>&nbsp;&nbsp;
115
-
116
- <a href="#M000044">initialize</a>&nbsp;&nbsp;
117
-
118
- <a href="#M000046">process_callbacks</a>&nbsp;&nbsp;
119
-
120
- <a href="#M000045">render</a>&nbsp;&nbsp;
121
-
98
+ <a href="#M000218">children</a>&nbsp;&nbsp;
99
+ <a href="#M000215">new</a>&nbsp;&nbsp;
100
+ <a href="#M000219">process_callbacks</a>&nbsp;&nbsp;
101
+ <a href="#M000216">render</a>&nbsp;&nbsp;
102
+ <a href="#M000217">state</a>&nbsp;&nbsp;
103
+ <a href="#M000220">state_decoration</a>&nbsp;&nbsp;
122
104
  </div>
123
105
  </div>
124
106
 
125
107
  </div>
126
108
 
127
- <!-- if includes -->
128
109
 
110
+ <!-- if includes -->
129
111
  <div id="includes">
130
112
  <h3 class="section-bar">Included Modules</h3>
131
113
 
132
114
  <div id="includes-list">
133
-
134
115
  <span class="include-name"><a href="DecorationMixin.html">Wee::DecorationMixin</a></span>
135
-
136
116
  <span class="include-name"><a href="CallAnswerMixin.html">Wee::CallAnswerMixin</a></span>
137
-
138
117
  </div>
139
118
  </div>
140
119
 
141
120
  <div id="section">
142
121
 
143
122
 
123
+ <div id="constants-list">
124
+ <h3 class="section-bar">Constants</h3>
144
125
 
126
+ <div class="name-list">
127
+ <table summary="Constants">
128
+ <tr class="top-aligned-row context-row">
129
+ <td class="context-item-name">NO_CHILDREN</td>
130
+ <td>=</td>
131
+ <td class="context-item-value">[].freeze</td>
132
+ </tr>
133
+ </table>
134
+ </div>
135
+ </div>
145
136
 
146
- <!-- if method_list -->
147
137
 
148
- <div id="methods">
149
138
 
150
- <h3 class="section-bar">Public Instance methods</h3>
139
+
151
140
 
152
141
 
153
- <div id="method-M000047" class="method-detail">
154
- <a name="M000047"></a>
142
+ <!-- if method_list -->
143
+ <div id="methods">
144
+ <h3 class="section-bar">Public Class methods</h3>
145
+
146
+ <div id="method-M000215" class="method-detail">
147
+ <a name="M000215"></a>
155
148
 
156
149
  <div class="method-heading">
150
+ <a href="#M000215" class="method-signature">
151
+ <span class="method-name">new</span><span class="method-args">()</span>
152
+ </a>
153
+ </div>
154
+
155
+ <div class="method-description">
156
+ <p>
157
+ Initializes a newly created component.
158
+ </p>
159
+ <p><a class="source-toggle" href="#"
160
+ onclick="toggleCode('M000215-source');return false;">[Source]</a></p>
161
+ <div class="method-source-code" id="M000215-source">
162
+ <pre>
163
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 16</span>
164
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
165
+ <span class="ruby-keyword kw">end</span>
166
+ </pre>
167
+ </div>
168
+ </div>
169
+ </div>
157
170
 
158
- <a href="#M000047" class="method-signature">
171
+ <h3 class="section-bar">Public Instance methods</h3>
159
172
 
160
- <span class="method-name">backtrack</span><span class="method-args">(state)</span>
173
+ <div id="method-M000218" class="method-detail">
174
+ <a name="M000218"></a>
161
175
 
176
+ <div class="method-heading">
177
+ <a href="#M000218" class="method-signature">
178
+ <span class="method-name">children</span><span class="method-args">()</span>
162
179
  </a>
163
-
164
180
  </div>
165
-
181
+
166
182
  <div class="method-description">
167
-
168
183
  <p>
169
- Take snapshots of objects that should correctly be backtracked.
170
- </p>
171
- <p>
172
- Backtracking means that you can go back in time of the components&#8217;
173
- state. Therefore it is neccessary to take snapshots of those objects that
174
- want to participate in backtracking. Taking snapshots of the whole
175
- component tree would be too expensive and unflexible. Note that methods
176
- <em>take_snapshot</em> and <em>restore_snapshot</em> are called for those
177
- objects to take the snapshot (they behave like <em>marshal_dump</em> and
178
- <em>marshal_load</em>). Overwrite them if you want to define special
179
- behaviour.
184
+ Return all child components.
180
185
  </p>
181
186
  <p>
182
- For example if you dynamically add children to your component, you might
183
- want to backtrack the children array:
187
+ <b>OVERWRITE</b> this method and return all child components collected in
188
+ an array.
184
189
  </p>
185
- <pre>
186
- def backtrack(state)
187
- super
188
- backtrack_children(state)
189
- end
190
- </pre>
191
- <p>
192
- By default only the decoration chain is backtracked. This is required to
193
- correctly backtrack called components. To disable backtracking of the
194
- decorations, change method <a
195
- href="Component.html#M000048">Component#backtrack_decoration</a> to a
196
- no-operation:
197
- </p>
198
- <pre>
199
- def backtrack_decoration(state)
200
- # nothing here
201
- end
202
- </pre>
203
- <dl>
204
- <dt><tt>state</tt></dt><dd>An object of class <a href="State.html">State</a>
205
-
206
- </dd>
207
- </dl>
208
-
209
190
  <p><a class="source-toggle" href="#"
210
- onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
211
- <div class="method-source-code" id="M000047-source">
191
+ onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
192
+ <div class="method-source-code" id="M000218-source">
212
193
  <pre>
213
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 88</span>
214
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack</span>(<span class="ruby-identifier">state</span>)
215
- <span class="ruby-identifier">backtrack_decoration</span>(<span class="ruby-identifier">state</span>)
216
- <span class="ruby-identifier">each_child</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
217
- <span class="ruby-identifier">child</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack</span>(<span class="ruby-identifier">state</span>)
218
- <span class="ruby-keyword kw">end</span>
194
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 69</span>
195
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">children</span>
196
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">NO_CHILDREN</span>
219
197
  <span class="ruby-keyword kw">end</span>
220
198
  </pre>
221
199
  </div>
222
-
223
200
  </div>
224
201
  </div>
225
202
 
226
-
227
- <div id="method-M000046" class="method-detail">
228
- <a name="M000046"></a>
203
+ <div id="method-M000219" class="method-detail">
204
+ <a name="M000219"></a>
229
205
 
230
206
  <div class="method-heading">
231
-
232
- <a href="#M000046" class="method-signature">
233
-
207
+ <a href="#M000219" class="method-signature">
234
208
  <span class="method-name">process_callbacks</span><span class="method-args">(callbacks)</span>
235
-
236
209
  </a>
237
-
238
210
  </div>
239
-
211
+
240
212
  <div class="method-description">
241
-
242
213
  <p>
243
214
  Process and invoke all callbacks specified for this component and all of
244
- it&#8217;s child components.
215
+ it&#8216;s child components.
245
216
  </p>
246
-
247
217
  <p><a class="source-toggle" href="#"
248
- onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
249
- <div class="method-source-code" id="M000046-source">
218
+ onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
219
+ <div class="method-source-code" id="M000219-source">
250
220
  <pre>
251
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 40</span>
221
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 77</span>
252
222
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callbacks</span>)
253
223
  <span class="ruby-identifier">callbacks</span>.<span class="ruby-identifier">input_callbacks</span>.<span class="ruby-identifier">each_triggered</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
254
224
  <span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>)
255
225
  <span class="ruby-keyword kw">end</span>
256
226
 
257
227
  <span class="ruby-comment cmt"># process callbacks of all children</span>
258
- <span class="ruby-identifier">each_child</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
228
+ <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">child</span> <span class="ruby-keyword kw">in</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">children</span>
259
229
  <span class="ruby-identifier">child</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callbacks</span>)
260
230
  <span class="ruby-keyword kw">end</span>
261
231
 
@@ -266,26 +236,19 @@ it&#8217;s child components.
266
236
  <span class="ruby-keyword kw">end</span>
267
237
  </pre>
268
238
  </div>
269
-
270
239
  </div>
271
240
  </div>
272
241
 
273
-
274
- <div id="method-M000045" class="method-detail">
275
- <a name="M000045"></a>
242
+ <div id="method-M000216" class="method-detail">
243
+ <a name="M000216"></a>
276
244
 
277
245
  <div class="method-heading">
278
-
279
- <a href="#M000045" class="method-signature">
280
-
246
+ <a href="#M000216" class="method-signature">
281
247
  <span class="method-name">render</span><span class="method-args">(r)</span>
282
-
283
248
  </a>
284
-
285
249
  </div>
286
-
250
+
287
251
  <div class="method-description">
288
-
289
252
  <p>
290
253
  This method renders the content of the component.
291
254
  </p>
@@ -298,222 +261,109 @@ view. By default this method does nothing!
298
261
 
299
262
  </dd>
300
263
  </dl>
301
-
302
264
  <p><a class="source-toggle" href="#"
303
- onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
304
- <div class="method-source-code" id="M000045-source">
265
+ onclick="toggleCode('M000216-source');return false;">[Source]</a></p>
266
+ <div class="method-source-code" id="M000216-source">
305
267
  <pre>
306
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 33</span>
268
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 28</span>
307
269
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">r</span>)
308
270
  <span class="ruby-keyword kw">end</span>
309
271
  </pre>
310
272
  </div>
311
-
312
273
  </div>
313
274
  </div>
314
275
 
315
-
316
- <h3 class="section-bar">Protected Instance methods</h3>
317
-
318
-
319
- <div id="method-M000051" class="method-detail">
320
- <a name="M000051"></a>
276
+ <div id="method-M000217" class="method-detail">
277
+ <a name="M000217"></a>
321
278
 
322
279
  <div class="method-heading">
323
-
324
- <a href="#M000051" class="method-signature">
325
-
326
- <span class="method-name">add_child</span><span class="method-args">(child)</span>
327
-
280
+ <a href="#M000217" class="method-signature">
281
+ <span class="method-name">state</span><span class="method-args">(s)</span>
328
282
  </a>
329
-
330
283
  </div>
331
-
284
+
332
285
  <div class="method-description">
333
-
334
286
  <p>
335
- Add a child to the component. Example:
287
+ Take snapshots of objects that should correctly be backtracked.
336
288
  </p>
337
- <pre>
338
- class YourComponent &lt; Wee::Component
339
- def initialize
340
- super()
341
- add_child ChildComponent.new
342
- end
343
- end
344
- </pre>
345
289
  <p>
346
- If you dynamically add child components to a component at run-time (not in
347
- initialize), then you should consider to backtrack the children array (of
348
- course only if you want backtracking at all):
290
+ Backtracking means that you can go back in time of the components&#8217; <a
291
+ href="Component.html#M000217">state</a>. Therefore it is neccessary to take
292
+ snapshots of those objects that want to participate in backtracking. Taking
293
+ snapshots of the whole component tree would be too expensive and
294
+ unflexible. Note that methods <em>take_snapshot</em> and
295
+ <em>restore_snapshot</em> are called for those objects to take the snapshot
296
+ (they behave like <em>marshal_dump</em> and <em>marshal_load</em>).
297
+ Overwrite them if you want to define special behaviour.
298
+ </p>
299
+ <p>
300
+ By default only the decoration chain is backtracked. This is required to
301
+ correctly backtrack called components. To disable backtracking of the
302
+ decorations, change method <a
303
+ href="Component.html#M000220">Component#state_decoration</a> to a
304
+ no-operation:
349
305
  </p>
350
306
  <pre>
351
- def backtrack(state)
352
- super
353
- state.add(self.children)
307
+ def state_decoration(s)
308
+ # nothing here
354
309
  end
355
310
  </pre>
311
+ <dl>
312
+ <dt><tt>s</tt></dt><dd>An object of class <a href="State.html">State</a>
356
313
 
314
+ </dd>
315
+ </dl>
357
316
  <p><a class="source-toggle" href="#"
358
- onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
359
- <div class="method-source-code" id="M000051-source">
360
- <pre>
361
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 131</span>
362
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
363
- (<span class="ruby-ivar">@children</span> <span class="ruby-operator">||=</span> []) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">child</span>
364
- <span class="ruby-identifier">child</span>
365
- <span class="ruby-keyword kw">end</span>
366
- </pre>
367
- </div>
368
-
369
- </div>
370
- </div>
371
-
372
-
373
- <div id="method-M000049" class="method-detail">
374
- <a name="M000049"></a>
375
-
376
- <div class="method-heading">
377
-
378
- <a href="#M000049" class="method-signature">
379
-
380
- <span class="method-name">backtrack_children</span><span class="method-args">(state)</span>
381
-
382
- </a>
383
-
384
- </div>
385
-
386
- <div class="method-description">
387
-
388
- <p><a class="source-toggle" href="#"
389
- onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
390
- <div class="method-source-code" id="M000049-source">
391
- <pre>
392
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 101</span>
393
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_children</span>(<span class="ruby-identifier">state</span>)
394
- <span class="ruby-identifier">state</span>.<span class="ruby-identifier">add_ivar</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:@children</span>, (<span class="ruby-ivar">@children</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">dup</span>))
395
- <span class="ruby-keyword kw">end</span>
396
- </pre>
397
- </div>
398
-
399
- </div>
400
- </div>
401
-
402
-
403
- <div id="method-M000048" class="method-detail">
404
- <a name="M000048"></a>
405
-
406
- <div class="method-heading">
407
-
408
- <a href="#M000048" class="method-signature">
409
-
410
- <span class="method-name">backtrack_decoration</span><span class="method-args">(state)</span>
411
-
412
- </a>
413
-
414
- </div>
415
-
416
- <div class="method-description">
417
-
418
- <p><a class="source-toggle" href="#"
419
- onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
420
- <div class="method-source-code" id="M000048-source">
421
- <pre>
422
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 97</span>
423
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_decoration</span>(<span class="ruby-identifier">state</span>)
424
- <span class="ruby-identifier">state</span>.<span class="ruby-identifier">add_ivar</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:@decoration</span>, <span class="ruby-ivar">@decoration</span>)
425
- <span class="ruby-keyword kw">end</span>
426
- </pre>
427
- </div>
428
-
429
- </div>
430
- </div>
431
-
432
-
433
- <div id="method-M000050" class="method-detail">
434
- <a name="M000050"></a>
435
-
436
- <div class="method-heading">
437
-
438
- <a href="#M000050" class="method-signature">
439
-
440
- <span class="method-name">each_child</span><span class="method-args">(&amp;block)</span>
441
-
442
- </a>
443
-
444
- </div>
445
-
446
- <div class="method-description">
447
-
448
- <p>
449
- Iterates over all direct child components.
450
- </p>
451
-
452
- <p><a class="source-toggle" href="#"
453
- onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
454
- <div class="method-source-code" id="M000050-source">
317
+ onclick="toggleCode('M000217-source');return false;">[Source]</a></p>
318
+ <div class="method-source-code" id="M000217-source">
455
319
  <pre>
456
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 108</span>
457
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_child</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
458
- <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@children</span>
320
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 55</span>
321
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">state</span>(<span class="ruby-identifier">s</span>)
322
+ <span class="ruby-identifier">state_decoration</span>(<span class="ruby-identifier">s</span>)
323
+ <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">child</span> <span class="ruby-keyword kw">in</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">children</span>
324
+ <span class="ruby-identifier">child</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">state</span>(<span class="ruby-identifier">s</span>)
325
+ <span class="ruby-keyword kw">end</span>
459
326
  <span class="ruby-keyword kw">end</span>
460
327
  </pre>
461
328
  </div>
462
-
463
329
  </div>
464
330
  </div>
465
331
 
332
+ <h3 class="section-bar">Protected Instance methods</h3>
466
333
 
467
- <div id="method-M000044" class="method-detail">
468
- <a name="M000044"></a>
334
+ <div id="method-M000220" class="method-detail">
335
+ <a name="M000220"></a>
469
336
 
470
337
  <div class="method-heading">
471
-
472
- <a href="#M000044" class="method-signature">
473
-
474
- <span class="method-name">initialize</span><span class="method-args">()</span>
475
-
338
+ <a href="#M000220" class="method-signature">
339
+ <span class="method-name">state_decoration</span><span class="method-args">(s)</span>
476
340
  </a>
477
-
478
341
  </div>
479
-
342
+
480
343
  <div class="method-description">
481
-
482
- <p>
483
- Initializes a newly created component.
484
- </p>
485
- <p>
486
- Call this method from your own components&#8217; <em>initialize</em> method
487
- using <tt>super</tt>, before setting up anything else!
488
- </p>
489
-
490
344
  <p><a class="source-toggle" href="#"
491
- onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
492
- <div class="method-source-code" id="M000044-source">
345
+ onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
346
+ <div class="method-source-code" id="M000220-source">
493
347
  <pre>
494
- <span class="ruby-comment cmt"># File lib/wee/component.rb, line 19</span>
495
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>() <span class="ruby-comment cmt"># :notnew:</span>
496
- <span class="ruby-ivar">@decoration</span> = <span class="ruby-keyword kw">self</span>
497
- <span class="ruby-ivar">@children</span> = <span class="ruby-keyword kw">nil</span>
348
+ <span class="ruby-comment cmt"># File lib/wee/component.rb, line 95</span>
349
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">state_decoration</span>(<span class="ruby-identifier">s</span>)
350
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">add_ivar</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:@decoration</span>, <span class="ruby-ivar">@decoration</span>)
498
351
  <span class="ruby-keyword kw">end</span>
499
352
  </pre>
500
353
  </div>
501
-
502
354
  </div>
503
355
  </div>
504
356
 
505
357
 
506
-
507
358
  </div>
508
359
 
509
360
 
510
-
511
-
512
361
  </div>
513
362
 
363
+
514
364
  <div id="validator-badges">
515
365
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
516
366
  </div>
517
367
 
518
368
  </body>
519
- </html>
369
+ </html>