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