wee 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/ChangeLog +132 -0
  2. data/INSTALL +13 -3
  3. data/README +3 -3
  4. data/Rakefile +5 -1
  5. data/bin/wee +100 -0
  6. data/doc/rdoc/classes/Array.html +12 -12
  7. data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
  8. data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
  9. data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
  10. data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
  11. data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
  12. data/doc/rdoc/classes/Enumerable.html +6 -6
  13. data/doc/rdoc/classes/Main.html +265 -0
  14. data/doc/rdoc/classes/Object.html +12 -12
  15. data/doc/rdoc/classes/OgApplication.html +2 -2
  16. data/doc/rdoc/classes/OgScaffolder.html +444 -64
  17. data/doc/rdoc/classes/OgScaffolder/Editor.html +490 -0
  18. data/doc/rdoc/classes/OgSession.html +4 -4
  19. data/doc/rdoc/classes/Recipe.html +113 -0
  20. data/doc/rdoc/classes/String.html +12 -12
  21. data/doc/rdoc/classes/Struct.html +12 -12
  22. data/doc/rdoc/classes/Wee.html +10 -1
  23. data/doc/rdoc/classes/Wee/AnswerDecoration.html +9 -9
  24. data/doc/rdoc/classes/Wee/Application.html +48 -47
  25. data/doc/rdoc/classes/Wee/Brush.html +19 -23
  26. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +17 -14
  27. data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +20 -14
  28. data/doc/rdoc/classes/Wee/Brush/FormTag.html +25 -21
  29. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
  30. data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
  31. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +234 -100
  32. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
  33. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +28 -22
  34. data/doc/rdoc/classes/Wee/Brush/ImageTag.html +23 -24
  35. data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
  36. data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
  37. data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
  38. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +33 -57
  39. data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +154 -0
  40. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
  41. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +20 -14
  42. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
  43. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
  44. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
  45. data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
  46. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +27 -21
  47. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +20 -14
  48. data/doc/rdoc/classes/Wee/CallbackRegistry.html +64 -36
  49. data/doc/rdoc/classes/Wee/CallbackStream.html +21 -21
  50. data/doc/rdoc/classes/Wee/Canvas.html +24 -24
  51. data/doc/rdoc/classes/Wee/Component.html +179 -151
  52. data/doc/rdoc/classes/Wee/Component/OnAnswer.html +12 -12
  53. data/doc/rdoc/classes/Wee/Decoration.html +42 -42
  54. data/doc/rdoc/classes/Wee/Delegate.html +27 -27
  55. data/doc/rdoc/classes/Wee/ErrorResponse.html +14 -14
  56. data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
  57. data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
  58. data/doc/rdoc/classes/Wee/HtmlCanvas.html +326 -219
  59. data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
  60. data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +19 -19
  61. data/doc/rdoc/classes/Wee/Md5IdGenerator.html +181 -0
  62. data/doc/rdoc/classes/Wee/MessageBox.html +12 -12
  63. data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
  64. data/doc/rdoc/classes/Wee/PagelessApplication.html +152 -0
  65. data/doc/rdoc/classes/Wee/PagelessRequest.html +177 -0
  66. data/doc/rdoc/classes/Wee/PagelessSession.html +320 -0
  67. data/doc/rdoc/classes/Wee/Presenter.html +145 -89
  68. data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
  69. data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
  70. data/doc/rdoc/classes/Wee/Request.html +116 -50
  71. data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
  72. data/doc/rdoc/classes/Wee/Response.html +76 -28
  73. data/doc/rdoc/classes/Wee/Session.html +129 -506
  74. data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +22 -40
  75. data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
  76. data/doc/rdoc/classes/Wee/Utils.html +70 -17
  77. data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
  78. data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
  79. data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +82 -49
  80. data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
  81. data/doc/rdoc/created.rid +1 -1
  82. data/doc/rdoc/files/INSTALL.html +17 -5
  83. data/doc/rdoc/files/README.html +9 -11
  84. data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
  85. data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
  86. data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
  87. data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -3
  88. data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
  89. data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
  90. data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
  91. data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +101 -0
  92. data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +101 -0
  93. data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +108 -0
  94. data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +101 -0
  95. data/doc/rdoc/files/lib/wee/databases/og_rb.html +4 -1
  96. data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +115 -0
  97. data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +107 -0
  98. data/doc/rdoc/files/lib/wee/pageless/application_rb.html +101 -0
  99. data/doc/rdoc/files/lib/wee/pageless/request_rb.html +101 -0
  100. data/doc/rdoc/files/lib/wee/pageless/session_rb.html +108 -0
  101. data/doc/rdoc/files/lib/wee/pageless_rb.html +110 -0
  102. data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
  103. data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +8 -1
  104. data/doc/rdoc/files/lib/wee/request_rb.html +1 -1
  105. data/doc/rdoc/files/lib/wee/response_rb.html +1 -1
  106. data/doc/rdoc/files/lib/wee/session_rb.html +1 -1
  107. data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +101 -0
  108. data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +114 -0
  109. data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +101 -0
  110. data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +115 -0
  111. data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +101 -0
  112. data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +111 -0
  113. data/doc/rdoc/files/lib/wee/template_rb.html +101 -0
  114. data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
  115. data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
  116. data/doc/rdoc/files/lib/wee_rb.html +4 -2
  117. data/doc/rdoc/fr_class_index.html +8 -4
  118. data/doc/rdoc/fr_file_index.html +17 -1
  119. data/doc/rdoc/fr_method_index.html +312 -267
  120. data/examples/live-update.rb +1 -1
  121. data/install.rb +14 -0
  122. data/lib/wee.rb +6 -2
  123. data/lib/wee/adaptors/webrick.rb +17 -5
  124. data/lib/wee/application.rb +2 -1
  125. data/lib/wee/continuation/session.rb +1 -146
  126. data/lib/wee/core/callback.rb +11 -5
  127. data/lib/wee/core/component.rb +14 -10
  128. data/lib/wee/databases/og.rb +3 -113
  129. data/lib/wee/databases/og/application.rb +3 -0
  130. data/lib/wee/databases/og/old_scaffolder.rb +98 -0
  131. data/lib/wee/databases/og/scaffolder.rb +174 -0
  132. data/lib/wee/databases/og/session.rb +9 -0
  133. data/lib/wee/idgen/md5.rb +21 -0
  134. data/lib/wee/{idgen.rb → idgen/simple.rb} +2 -4
  135. data/lib/wee/pageless.rb +3 -0
  136. data/lib/wee/pageless/application.rb +9 -0
  137. data/lib/wee/pageless/request.rb +15 -0
  138. data/lib/wee/pageless/session.rb +89 -0
  139. data/lib/wee/renderer/html/brushes.rb +100 -115
  140. data/lib/wee/renderer/html/canvas.rb +32 -2
  141. data/lib/wee/request.rb +36 -24
  142. data/lib/wee/response.rb +8 -1
  143. data/lib/wee/session.rb +13 -7
  144. data/lib/wee/skeleton/og/README +38 -0
  145. data/lib/wee/skeleton/og/components/main.rb +16 -0
  146. data/lib/wee/skeleton/og/conf/db.rb +8 -0
  147. data/lib/wee/skeleton/og/models/recipe.rb +5 -0
  148. data/lib/wee/skeleton/og/run.rb +23 -0
  149. data/lib/wee/skeleton/simple/README +32 -0
  150. data/lib/wee/skeleton/simple/components/main.rb +25 -0
  151. data/lib/wee/skeleton/simple/run.rb +12 -0
  152. data/lib/wee/template.rb +28 -0
  153. data/lib/wee/utils/autoreload.rb +29 -0
  154. data/lib/wee/utils/helper.rb +9 -5
  155. data/test/test_request.rb +4 -3
  156. data/wee.gemspec +3 -1
  157. metadata +91 -22
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/lib/wee/idgen_rb.html">
59
- lib/wee/idgen.rb
58
+ <a href="../../files/lib/wee/idgen/simple_rb.html">
59
+ lib/wee/idgen/simple.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -80,6 +80,12 @@
80
80
 
81
81
  <div id="contextContent">
82
82
 
83
+ <div id="description">
84
+ <p>
85
+ Returned ids are guaranteed to be unique, but they are easily guessable.
86
+ </p>
87
+
88
+ </div>
83
89
 
84
90
 
85
91
  </div>
@@ -88,9 +94,8 @@
88
94
  <h3 class="section-bar">Methods</h3>
89
95
 
90
96
  <div class="name-list">
91
- <a href="#M000202">current</a>&nbsp;&nbsp;
92
- <a href="#M000201">new</a>&nbsp;&nbsp;
93
- <a href="#M000203">next</a>&nbsp;&nbsp;
97
+ <a href="#M000231">new</a>&nbsp;&nbsp;
98
+ <a href="#M000232">next</a>&nbsp;&nbsp;
94
99
  </div>
95
100
  </div>
96
101
 
@@ -112,21 +117,21 @@
112
117
  <div id="methods">
113
118
  <h3 class="section-bar">Public Class methods</h3>
114
119
 
115
- <div id="method-M000201" class="method-detail">
116
- <a name="M000201"></a>
120
+ <div id="method-M000231" class="method-detail">
121
+ <a name="M000231"></a>
117
122
 
118
123
  <div class="method-heading">
119
- <a href="#M000201" class="method-signature">
124
+ <a href="#M000231" class="method-signature">
120
125
  <span class="method-name">new</span><span class="method-args">(initial_value=0)</span>
121
126
  </a>
122
127
  </div>
123
128
 
124
129
  <div class="method-description">
125
130
  <p><a class="source-toggle" href="#"
126
- onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
127
- <div class="method-source-code" id="M000201-source">
131
+ onclick="toggleCode('M000231-source');return false;">[Source]</a></p>
132
+ <div class="method-source-code" id="M000231-source">
128
133
  <pre>
129
- <span class="ruby-comment cmt"># File lib/wee/idgen.rb, line 2</span>
134
+ <span class="ruby-comment cmt"># File lib/wee/idgen/simple.rb, line 4</span>
130
135
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">initial_value</span>=<span class="ruby-value">0</span>)
131
136
  <span class="ruby-ivar">@value</span> = <span class="ruby-identifier">initial_value</span>
132
137
  <span class="ruby-keyword kw">end</span>
@@ -137,44 +142,21 @@
137
142
 
138
143
  <h3 class="section-bar">Public Instance methods</h3>
139
144
 
140
- <div id="method-M000202" class="method-detail">
141
- <a name="M000202"></a>
142
-
143
- <div class="method-heading">
144
- <a href="#M000202" class="method-signature">
145
- <span class="method-name">current</span><span class="method-args">()</span>
146
- </a>
147
- </div>
148
-
149
- <div class="method-description">
150
- <p><a class="source-toggle" href="#"
151
- onclick="toggleCode('M000202-source');return false;">[Source]</a></p>
152
- <div class="method-source-code" id="M000202-source">
153
- <pre>
154
- <span class="ruby-comment cmt"># File lib/wee/idgen.rb, line 6</span>
155
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current</span>
156
- <span class="ruby-ivar">@value</span>
157
- <span class="ruby-keyword kw">end</span>
158
- </pre>
159
- </div>
160
- </div>
161
- </div>
162
-
163
- <div id="method-M000203" class="method-detail">
164
- <a name="M000203"></a>
145
+ <div id="method-M000232" class="method-detail">
146
+ <a name="M000232"></a>
165
147
 
166
148
  <div class="method-heading">
167
- <a href="#M000203" class="method-signature">
149
+ <a href="#M000232" class="method-signature">
168
150
  <span class="method-name">next</span><span class="method-args">()</span>
169
151
  </a>
170
152
  </div>
171
153
 
172
154
  <div class="method-description">
173
155
  <p><a class="source-toggle" href="#"
174
- onclick="toggleCode('M000203-source');return false;">[Source]</a></p>
175
- <div class="method-source-code" id="M000203-source">
156
+ onclick="toggleCode('M000232-source');return false;">[Source]</a></p>
157
+ <div class="method-source-code" id="M000232-source">
176
158
  <pre>
177
- <span class="ruby-comment cmt"># File lib/wee/idgen.rb, line 10</span>
159
+ <span class="ruby-comment cmt"># File lib/wee/idgen/simple.rb, line 8</span>
178
160
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">next</span>
179
161
  <span class="ruby-ivar">@value</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
180
162
  <span class="ruby-keyword kw">end</span>
@@ -86,7 +86,7 @@ This class is for backtracking the state of components (or
86
86
  decorations/presenters). Components that want an undo-facility to be
87
87
  implemented (triggered for example by a browsers back-button), have to
88
88
  overwrite the <a
89
- href="Component.html#M000222">Component#backtrack_state</a> method. Class
89
+ href="Component.html#M000263">Component#backtrack_state</a> method. Class
90
90
  <a href="Snapshot.html">Wee::Snapshot</a> simply represents a collection of
91
91
  objects from which snapshots were taken via methods take_snapshot.
92
92
  </p>
@@ -100,9 +100,9 @@ objects from which snapshots were taken via methods take_snapshot.
100
100
  <h3 class="section-bar">Methods</h3>
101
101
 
102
102
  <div class="name-list">
103
- <a href="#M000093">add</a>&nbsp;&nbsp;
104
- <a href="#M000092">new</a>&nbsp;&nbsp;
105
- <a href="#M000094">restore</a>&nbsp;&nbsp;
103
+ <a href="#M000138">add</a>&nbsp;&nbsp;
104
+ <a href="#M000137">new</a>&nbsp;&nbsp;
105
+ <a href="#M000139">restore</a>&nbsp;&nbsp;
106
106
  </div>
107
107
  </div>
108
108
 
@@ -124,19 +124,19 @@ objects from which snapshots were taken via methods take_snapshot.
124
124
  <div id="methods">
125
125
  <h3 class="section-bar">Public Class methods</h3>
126
126
 
127
- <div id="method-M000092" class="method-detail">
128
- <a name="M000092"></a>
127
+ <div id="method-M000137" class="method-detail">
128
+ <a name="M000137"></a>
129
129
 
130
130
  <div class="method-heading">
131
- <a href="#M000092" class="method-signature">
131
+ <a href="#M000137" class="method-signature">
132
132
  <span class="method-name">new</span><span class="method-args">()</span>
133
133
  </a>
134
134
  </div>
135
135
 
136
136
  <div class="method-description">
137
137
  <p><a class="source-toggle" href="#"
138
- onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
139
- <div class="method-source-code" id="M000092-source">
138
+ onclick="toggleCode('M000137-source');return false;">[Source]</a></p>
139
+ <div class="method-source-code" id="M000137-source">
140
140
  <pre>
141
141
  <span class="ruby-comment cmt"># File lib/wee/core/snapshot.rb, line 9</span>
142
142
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
@@ -149,19 +149,19 @@ objects from which snapshots were taken via methods take_snapshot.
149
149
 
150
150
  <h3 class="section-bar">Public Instance methods</h3>
151
151
 
152
- <div id="method-M000093" class="method-detail">
153
- <a name="M000093"></a>
152
+ <div id="method-M000138" class="method-detail">
153
+ <a name="M000138"></a>
154
154
 
155
155
  <div class="method-heading">
156
- <a href="#M000093" class="method-signature">
156
+ <a href="#M000138" class="method-signature">
157
157
  <span class="method-name">add</span><span class="method-args">(object)</span>
158
158
  </a>
159
159
  </div>
160
160
 
161
161
  <div class="method-description">
162
162
  <p><a class="source-toggle" href="#"
163
- onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
164
- <div class="method-source-code" id="M000093-source">
163
+ onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
164
+ <div class="method-source-code" id="M000138-source">
165
165
  <pre>
166
166
  <span class="ruby-comment cmt"># File lib/wee/core/snapshot.rb, line 13</span>
167
167
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">object</span>)
@@ -173,19 +173,19 @@ objects from which snapshots were taken via methods take_snapshot.
173
173
  </div>
174
174
  </div>
175
175
 
176
- <div id="method-M000094" class="method-detail">
177
- <a name="M000094"></a>
176
+ <div id="method-M000139" class="method-detail">
177
+ <a name="M000139"></a>
178
178
 
179
179
  <div class="method-heading">
180
- <a href="#M000094" class="method-signature">
180
+ <a href="#M000139" class="method-signature">
181
181
  <span class="method-name">restore</span><span class="method-args">()</span>
182
182
  </a>
183
183
  </div>
184
184
 
185
185
  <div class="method-description">
186
186
  <p><a class="source-toggle" href="#"
187
- onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
188
- <div class="method-source-code" id="M000094-source">
187
+ onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
188
+ <div class="method-source-code" id="M000139-source">
189
189
  <pre>
190
190
  <span class="ruby-comment cmt"># File lib/wee/core/snapshot.rb, line 18</span>
191
191
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore</span>
@@ -88,8 +88,9 @@
88
88
  <h3 class="section-bar">Methods</h3>
89
89
 
90
90
  <div class="name-list">
91
- <a href="#M000045">app_for</a>&nbsp;&nbsp;
92
- <a href="#M000044">autoreload</a>&nbsp;&nbsp;
91
+ <a href="#M000079">app_for</a>&nbsp;&nbsp;
92
+ <a href="#M000077">autoreload</a>&nbsp;&nbsp;
93
+ <a href="#M000078">autoreload_glob</a>&nbsp;&nbsp;
93
94
  </div>
94
95
  </div>
95
96
 
@@ -117,11 +118,11 @@
117
118
  <div id="methods">
118
119
  <h3 class="section-bar">Public Class methods</h3>
119
120
 
120
- <div id="method-M000045" class="method-detail">
121
- <a name="M000045"></a>
121
+ <div id="method-M000079" class="method-detail">
122
+ <a name="M000079"></a>
122
123
 
123
124
  <div class="method-heading">
124
- <a href="#M000045" class="method-signature">
125
+ <a href="#M000079" class="method-signature">
125
126
  <span class="method-name">app_for</span><span class="method-args">(component=nil, options={}, &amp;block)</span>
126
127
  </a>
127
128
  </div>
@@ -145,16 +146,16 @@ href="Application.html">Wee::Application</a>)
145
146
  <dt>:page_cache_capacity</dt><dd>The size of the sessions page_store (default: 10)
146
147
 
147
148
  </dd>
148
- <dt>:id_seed</dt><dd>Initial value of the <a href="SimpleIdGenerator.html">SimpleIdGenerator</a>
149
- (default: rand(1_000_000))
149
+ <dt>:id_gen</dt><dd>The id generator to use for session-ids (default: <a
150
+ href="Md5IdGenerator.html#M000133">Md5IdGenerator.new</a>)
150
151
 
151
152
  </dd>
152
153
  </dl>
153
154
  </dd>
154
155
  </dl>
155
156
  <p><a class="source-toggle" href="#"
156
- onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
157
- <div class="method-source-code" id="M000045-source">
157
+ onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
158
+ <div class="method-source-code" id="M000079-source">
158
159
  <pre>
159
160
  <span class="ruby-comment cmt"># File lib/wee/utils/helper.rb, line 22</span>
160
161
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">app_for</span>(<span class="ruby-identifier">component</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
@@ -164,7 +165,7 @@ href="Application.html">Wee::Application</a>)
164
165
  <span class="ruby-identifier">:application</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Application</span>,
165
166
  <span class="ruby-identifier">:session</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Session</span>,
166
167
  <span class="ruby-identifier">:page_cache_capacity</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>,
167
- <span class="ruby-identifier">:id_seed</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">1_000_000</span>)
168
+ <span class="ruby-identifier">:id_gen</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Md5IdGenerator</span>.<span class="ruby-identifier">new</span>
168
169
  }
169
170
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span>)
170
171
 
@@ -176,10 +177,14 @@ href="Application.html">Wee::Application</a>)
176
177
  <span class="ruby-keyword kw">else</span>
177
178
  <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">root_component</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
178
179
  <span class="ruby-keyword kw">end</span>
179
- <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">page_store</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">LRUCache</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:page_cache_capacity</span>])
180
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:page_store=</span>)
181
+ <span class="ruby-comment cmt"># This is so that you can use a Pageless session, which does not have</span>
182
+ <span class="ruby-comment cmt"># a page_store.</span>
183
+ <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">page_store</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">LRUCache</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:page_cache_capacity</span>])
184
+ <span class="ruby-keyword kw">end</span>
180
185
  }
181
186
  }
182
- <span class="ruby-identifier">app</span>.<span class="ruby-identifier">id_generator</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:id_seed</span>])
187
+ <span class="ruby-identifier">app</span>.<span class="ruby-identifier">id_generator</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:id_gen</span>]
183
188
  }
184
189
  <span class="ruby-keyword kw">end</span>
185
190
  </pre>
@@ -189,19 +194,19 @@ href="Application.html">Wee::Application</a>)
189
194
 
190
195
  <h3 class="section-bar">Public Instance methods</h3>
191
196
 
192
- <div id="method-M000044" class="method-detail">
193
- <a name="M000044"></a>
197
+ <div id="method-M000077" class="method-detail">
198
+ <a name="M000077"></a>
194
199
 
195
200
  <div class="method-heading">
196
- <a href="#M000044" class="method-signature">
201
+ <a href="#M000077" class="method-signature">
197
202
  <span class="method-name">autoreload</span><span class="method-args">(check_interval=10)</span>
198
203
  </a>
199
204
  </div>
200
205
 
201
206
  <div class="method-description">
202
207
  <p><a class="source-toggle" href="#"
203
- onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
204
- <div class="method-source-code" id="M000044-source">
208
+ onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000077-source">
205
210
  <pre>
206
211
  <span class="ruby-comment cmt"># File lib/wee/utils/autoreload.rb, line 4</span>
207
212
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autoreload</span>(<span class="ruby-identifier">check_interval</span>=<span class="ruby-value">10</span>)
@@ -232,6 +237,54 @@ href="Application.html">Wee::Application</a>)
232
237
  </div>
233
238
  </div>
234
239
 
240
+ <div id="method-M000078" class="method-detail">
241
+ <a name="M000078"></a>
242
+
243
+ <div class="method-heading">
244
+ <a href="#M000078" class="method-signature">
245
+ <span class="method-name">autoreload_glob</span><span class="method-args">(glob, check_interval=1)</span>
246
+ </a>
247
+ </div>
248
+
249
+ <div class="method-description">
250
+ <p>
251
+ Note that this method will load any file that matches the glob and in
252
+ modified since the method call, regardless whether it&#8217;s loaded by the
253
+ current application or not. The glob is expanded only once at the initial
254
+ method call.
255
+ </p>
256
+ <p><a class="source-toggle" href="#"
257
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
258
+ <div class="method-source-code" id="M000078-source">
259
+ <pre>
260
+ <span class="ruby-comment cmt"># File lib/wee/utils/autoreload.rb, line 33</span>
261
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autoreload_glob</span>(<span class="ruby-identifier">glob</span>, <span class="ruby-identifier">check_interval</span>=<span class="ruby-value">1</span>)
262
+ <span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">glob</span>)
263
+ <span class="ruby-identifier">file_mtime</span> = {}
264
+ <span class="ruby-identifier">start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
265
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
266
+ <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
267
+ <span class="ruby-identifier">sleep</span> <span class="ruby-identifier">check_interval</span>
268
+ <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
269
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword kw">and</span>
270
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">mtime</span> <span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">file_mtime</span>[<span class="ruby-identifier">file</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">start_time</span>))
271
+ <span class="ruby-identifier">file_mtime</span>[<span class="ruby-identifier">file</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">mtime</span>
272
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;reload #{ file }&quot;</span>
273
+ <span class="ruby-keyword kw">begin</span>
274
+ <span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
275
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
276
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span>
277
+ <span class="ruby-keyword kw">end</span>
278
+ <span class="ruby-keyword kw">end</span>
279
+ <span class="ruby-keyword kw">end</span>
280
+ <span class="ruby-keyword kw">end</span>
281
+ }
282
+ <span class="ruby-keyword kw">end</span>
283
+ </pre>
284
+ </div>
285
+ </div>
286
+ </div>
287
+
235
288
 
236
289
  </div>
237
290
 
@@ -88,7 +88,7 @@
88
88
  <h3 class="section-bar">Methods</h3>
89
89
 
90
90
  <div class="name-list">
91
- <a href="#M000046">new</a>&nbsp;&nbsp;
91
+ <a href="#M000080">new</a>&nbsp;&nbsp;
92
92
  </div>
93
93
  </div>
94
94
 
@@ -110,19 +110,19 @@
110
110
  <div id="methods">
111
111
  <h3 class="section-bar">Public Class methods</h3>
112
112
 
113
- <div id="method-M000046" class="method-detail">
114
- <a name="M000046"></a>
113
+ <div id="method-M000080" class="method-detail">
114
+ <a name="M000080"></a>
115
115
 
116
116
  <div class="method-heading">
117
- <a href="#M000046" class="method-signature">
117
+ <a href="#M000080" class="method-signature">
118
118
  <span class="method-name">new</span><span class="method-args">(capacity=20)</span>
119
119
  </a>
120
120
  </div>
121
121
 
122
122
  <div class="method-description">
123
123
  <p><a class="source-toggle" href="#"
124
- onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
125
- <div class="method-source-code" id="M000046-source">
124
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000080-source">
126
126
  <pre>
127
127
  <span class="ruby-comment cmt"># File lib/wee/utils/cache.rb, line 4</span>
128
128
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">capacity</span>=<span class="ruby-value">20</span>)
@@ -97,9 +97,9 @@ href="Component.html">Wee::Component</a>.
97
97
  <h3 class="section-bar">Methods</h3>
98
98
 
99
99
  <div class="name-list">
100
- <a href="#M000205">new</a>&nbsp;&nbsp;
101
- <a href="#M000207">restore_snapshot</a>&nbsp;&nbsp;
102
- <a href="#M000206">take_snapshot</a>&nbsp;&nbsp;
100
+ <a href="#M000246">new</a>&nbsp;&nbsp;
101
+ <a href="#M000248">restore_snapshot</a>&nbsp;&nbsp;
102
+ <a href="#M000247">take_snapshot</a>&nbsp;&nbsp;
103
103
  </div>
104
104
  </div>
105
105
 
@@ -134,19 +134,19 @@ href="Component.html">Wee::Component</a>.
134
134
  <div id="methods">
135
135
  <h3 class="section-bar">Public Class methods</h3>
136
136
 
137
- <div id="method-M000205" class="method-detail">
138
- <a name="M000205"></a>
137
+ <div id="method-M000246" class="method-detail">
138
+ <a name="M000246"></a>
139
139
 
140
140
  <div class="method-heading">
141
- <a href="#M000205" class="method-signature">
141
+ <a href="#M000246" class="method-signature">
142
142
  <span class="method-name">new</span><span class="method-args">(value=nil)</span>
143
143
  </a>
144
144
  </div>
145
145
 
146
146
  <div class="method-description">
147
147
  <p><a class="source-toggle" href="#"
148
- onclick="toggleCode('M000205-source');return false;">[Source]</a></p>
149
- <div class="method-source-code" id="M000205-source">
148
+ onclick="toggleCode('M000246-source');return false;">[Source]</a></p>
149
+ <div class="method-source-code" id="M000246-source">
150
150
  <pre>
151
151
  <span class="ruby-comment cmt"># File lib/wee/core/valueholder.rb, line 8</span>
152
152
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">value</span>=<span class="ruby-keyword kw">nil</span>)
@@ -159,19 +159,19 @@ href="Component.html">Wee::Component</a>.
159
159
 
160
160
  <h3 class="section-bar">Public Instance methods</h3>
161
161
 
162
- <div id="method-M000207" class="method-detail">
163
- <a name="M000207"></a>
162
+ <div id="method-M000248" class="method-detail">
163
+ <a name="M000248"></a>
164
164
 
165
165
  <div class="method-heading">
166
- <a href="#M000207" class="method-signature">
166
+ <a href="#M000248" class="method-signature">
167
167
  <span class="method-name">restore_snapshot</span><span class="method-args">(value)</span>
168
168
  </a>
169
169
  </div>
170
170
 
171
171
  <div class="method-description">
172
172
  <p><a class="source-toggle" href="#"
173
- onclick="toggleCode('M000207-source');return false;">[Source]</a></p>
174
- <div class="method-source-code" id="M000207-source">
173
+ onclick="toggleCode('M000248-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000248-source">
175
175
  <pre>
176
176
  <span class="ruby-comment cmt"># File lib/wee/core/valueholder.rb, line 16</span>
177
177
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore_snapshot</span>(<span class="ruby-identifier">value</span>)
@@ -182,19 +182,19 @@ href="Component.html">Wee::Component</a>.
182
182
  </div>
183
183
  </div>
184
184
 
185
- <div id="method-M000206" class="method-detail">
186
- <a name="M000206"></a>
185
+ <div id="method-M000247" class="method-detail">
186
+ <a name="M000247"></a>
187
187
 
188
188
  <div class="method-heading">
189
- <a href="#M000206" class="method-signature">
189
+ <a href="#M000247" class="method-signature">
190
190
  <span class="method-name">take_snapshot</span><span class="method-args">()</span>
191
191
  </a>
192
192
  </div>
193
193
 
194
194
  <div class="method-description">
195
195
  <p><a class="source-toggle" href="#"
196
- onclick="toggleCode('M000206-source');return false;">[Source]</a></p>
197
- <div class="method-source-code" id="M000206-source">
196
+ onclick="toggleCode('M000247-source');return false;">[Source]</a></p>
197
+ <div class="method-source-code" id="M000247-source">
198
198
  <pre>
199
199
  <span class="ruby-comment cmt"># File lib/wee/core/valueholder.rb, line 12</span>
200
200
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">take_snapshot</span>