bridge-ruby 0.2.0
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/LICENSE +19 -0
- data/README.md +31 -0
- data/Rakefile +24 -0
- data/bridge-ruby.gemspec +24 -0
- data/doc/Bridge.html +276 -0
- data/doc/Bridge/Bridge.html +1874 -0
- data/doc/Bridge/Bridge/SystemService.html +396 -0
- data/doc/Bridge/Client.html +271 -0
- data/doc/Bridge/Connection.html +1180 -0
- data/doc/Bridge/Connection/SockBuffer.html +322 -0
- data/doc/Bridge/Reference.html +605 -0
- data/doc/Bridge/Serializer.html +405 -0
- data/doc/Bridge/Serializer/Callback.html +498 -0
- data/doc/Bridge/Tcp.html +657 -0
- data/doc/Bridge/Util.html +643 -0
- data/doc/Bridge/Util/CallbackReference.html +557 -0
- data/doc/OpenSSL/X509/Certificate.html +275 -0
- data/doc/SSLCertificateVerification.html +446 -0
- data/doc/_index.html +239 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +106 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +106 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +772 -0
- data/doc/top-level-namespace.html +112 -0
- data/examples/channels/client-writeable.rb +24 -0
- data/examples/channels/client.rb +23 -0
- data/examples/channels/server.rb +24 -0
- data/examples/chat/chatclient.rb +21 -0
- data/examples/chat/chatserver.rb +24 -0
- data/examples/client-context/client.rb +21 -0
- data/examples/client-context/server.rb +25 -0
- data/examples/secure/example.rb +8 -0
- data/examples/simple/channels.rb +47 -0
- data/examples/simple/services.rb +41 -0
- data/include/ssl/cacert.pem +3331 -0
- data/lib/bridge-ruby.rb +441 -0
- data/lib/client.rb +14 -0
- data/lib/connection.rb +162 -0
- data/lib/reference.rb +49 -0
- data/lib/serializer.rb +104 -0
- data/lib/ssl_utils.rb +68 -0
- data/lib/tcp.rb +73 -0
- data/lib/util.rb +101 -0
- data/lib/version.rb +3 -0
- data/rakelib/package.rake +4 -0
- data/rakelib/test.rake +8 -0
- data/test/regression/reconnect.rb +48 -0
- data/test/regression/rpc.rb +39 -0
- data/test/regression/test.rb +58 -0
- data/test/unit/bridge_dummy.rb +26 -0
- data/test/unit/connection_dummy.rb +21 -0
- data/test/unit/reference_dummy.rb +11 -0
- data/test/unit/tcp_dummy.rb +12 -0
- data/test/unit/test.rb +20 -0
- data/test/unit/test_reference.rb +30 -0
- data/test/unit/test_serializer.rb +109 -0
- data/test/unit/test_tcp.rb +51 -0
- data/test/unit/test_util.rb +59 -0
- metadata +162 -0
@@ -0,0 +1,322 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Bridge::Connection::SockBuffer
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (S)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Bridge.html" title="Bridge (module)">Bridge</a></span></span> » <span class='title'><span class='object_link'><a href="../Connection.html" title="Bridge::Connection (class)">Connection</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">SockBuffer</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Bridge::Connection::SockBuffer
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Bridge::Connection::SockBuffer</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/connection.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Instance Method Summary
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (SockBuffer) <strong>initialize</strong> </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
<span class="note title constructor">constructor</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc"><div class='inline'>
|
137
|
+
<p>A new instance of SockBuffer.</p>
|
138
|
+
</div></span>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
|
143
|
+
<li class="public ">
|
144
|
+
<span class="summary_signature">
|
145
|
+
|
146
|
+
<a href="#process_queue-instance_method" title="#process_queue (instance method)">- (Object) <strong>process_queue</strong>(sock, client_id) </a>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
</span>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
161
|
+
|
162
|
+
</li>
|
163
|
+
|
164
|
+
|
165
|
+
<li class="public ">
|
166
|
+
<span class="summary_signature">
|
167
|
+
|
168
|
+
<a href="#send-instance_method" title="#send (instance method)">- (Object) <strong>send</strong>(msg) </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
</ul>
|
188
|
+
|
189
|
+
|
190
|
+
<div id="constructor_details" class="method_details_list">
|
191
|
+
<h2>Constructor Details</h2>
|
192
|
+
|
193
|
+
<div class="method_details first">
|
194
|
+
<h3 class="signature first" id="initialize-instance_method">
|
195
|
+
|
196
|
+
- (<tt><span class='object_link'><a href="" title="Bridge::Connection::SockBuffer (class)">SockBuffer</a></span></tt>) <strong>initialize</strong>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</h3><div class="docstring">
|
203
|
+
<div class="discussion">
|
204
|
+
|
205
|
+
<p>A new instance of SockBuffer</p>
|
206
|
+
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
<div class="tags">
|
211
|
+
|
212
|
+
|
213
|
+
</div><table class="source_code">
|
214
|
+
<tr>
|
215
|
+
<td>
|
216
|
+
<pre class="lines">
|
217
|
+
|
218
|
+
|
219
|
+
143
|
220
|
+
144
|
221
|
+
145
|
222
|
+
146</pre>
|
223
|
+
</td>
|
224
|
+
<td>
|
225
|
+
<pre class="code"><span class="info file"># File 'lib/connection.rb', line 143</span>
|
226
|
+
|
227
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
228
|
+
<span class='comment'># Buffer for preconnect messages
|
229
|
+
</span> <span class='ivar'>@buffer</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
230
|
+
<span class='kw'>end</span></pre>
|
231
|
+
</td>
|
232
|
+
</tr>
|
233
|
+
</table>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
<div id="instance_method_details" class="method_details_list">
|
240
|
+
<h2>Instance Method Details</h2>
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method_details first">
|
244
|
+
<h3 class="signature first" id="process_queue-instance_method">
|
245
|
+
|
246
|
+
- (<tt>Object</tt>) <strong>process_queue</strong>(sock, client_id)
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</h3><table class="source_code">
|
253
|
+
<tr>
|
254
|
+
<td>
|
255
|
+
<pre class="lines">
|
256
|
+
|
257
|
+
|
258
|
+
152
|
259
|
+
153
|
260
|
+
154
|
261
|
+
155
|
262
|
+
156
|
263
|
+
157
|
264
|
+
158</pre>
|
265
|
+
</td>
|
266
|
+
<td>
|
267
|
+
<pre class="code"><span class="info file"># File 'lib/connection.rb', line 152</span>
|
268
|
+
|
269
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_queue'>process_queue</span> <span class='id identifier rubyid_sock'>sock</span><span class='comma'>,</span> <span class='id identifier rubyid_client_id'>client_id</span>
|
270
|
+
<span class='ivar'>@buffer</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
|
271
|
+
<span class='comment'># Replace null client ids with actual client_id after handshake
|
272
|
+
</span> <span class='id identifier rubyid_sock'>sock</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span> <span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>"client",null</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>"client","</span><span class='tstring_end'>'</span></span><span class='op'>+</span> <span class='id identifier rubyid_client_id'>client_id</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>"</span><span class='tstring_end'>'</span></span> <span class='rparen'>)</span>
|
273
|
+
<span class='kw'>end</span>
|
274
|
+
<span class='ivar'>@buffer</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
275
|
+
<span class='kw'>end</span></pre>
|
276
|
+
</td>
|
277
|
+
</tr>
|
278
|
+
</table>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
<div class="method_details ">
|
282
|
+
<h3 class="signature " id="send-instance_method">
|
283
|
+
|
284
|
+
- (<tt>Object</tt>) <strong>send</strong>(msg)
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</h3><table class="source_code">
|
291
|
+
<tr>
|
292
|
+
<td>
|
293
|
+
<pre class="lines">
|
294
|
+
|
295
|
+
|
296
|
+
148
|
297
|
+
149
|
298
|
+
150</pre>
|
299
|
+
</td>
|
300
|
+
<td>
|
301
|
+
<pre class="code"><span class="info file"># File 'lib/connection.rb', line 148</span>
|
302
|
+
|
303
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_msg'>msg</span>
|
304
|
+
<span class='ivar'>@buffer</span> <span class='op'><<</span> <span class='id identifier rubyid_msg'>msg</span>
|
305
|
+
<span class='kw'>end</span></pre>
|
306
|
+
</td>
|
307
|
+
</tr>
|
308
|
+
</table>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
</div>
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<div id="footer">
|
316
|
+
Generated on Wed Jun 20 11:00:11 2012 by
|
317
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
318
|
+
0.8.2.1 (ruby-1.9.3).
|
319
|
+
</div>
|
320
|
+
|
321
|
+
</body>
|
322
|
+
</html>
|
@@ -0,0 +1,605 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Bridge::Reference
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (R)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Bridge.html" title="Bridge (module)">Bridge</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Reference</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Bridge::Reference
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Bridge::Reference</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/reference.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Instances of this class represent references to remote services.</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
118
|
+
<ul class="summary">
|
119
|
+
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#address-instance_method" title="#address (instance method)">- (Object) <strong>address</strong> </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="summary_desc"><div class='inline'>
|
141
|
+
<p>:nodoc: all.</p>
|
142
|
+
</div></span>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
146
|
+
|
147
|
+
<li class="public ">
|
148
|
+
<span class="summary_signature">
|
149
|
+
|
150
|
+
<a href="#operations-instance_method" title="#operations (instance method)">- (Object) <strong>operations</strong> </a>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
</span>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'>
|
168
|
+
<p>:nodoc: all.</p>
|
169
|
+
</div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
</ul>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<h2>
|
181
|
+
Instance Method Summary
|
182
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
183
|
+
</h2>
|
184
|
+
|
185
|
+
<ul class="summary">
|
186
|
+
|
187
|
+
<li class="public ">
|
188
|
+
<span class="summary_signature">
|
189
|
+
|
190
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Reference) <strong>initialize</strong>(bridge, address, operations = nil) </a>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</span>
|
195
|
+
|
196
|
+
|
197
|
+
<span class="note title constructor">constructor</span>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<span class="summary_desc"><div class='inline'>
|
207
|
+
<p>A new instance of Reference.</p>
|
208
|
+
</div></span>
|
209
|
+
|
210
|
+
</li>
|
211
|
+
|
212
|
+
|
213
|
+
<li class="public ">
|
214
|
+
<span class="summary_signature">
|
215
|
+
|
216
|
+
<a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(atom, *args, &blk) </a>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
</span>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
231
|
+
|
232
|
+
</li>
|
233
|
+
|
234
|
+
|
235
|
+
<li class="public ">
|
236
|
+
<span class="summary_signature">
|
237
|
+
|
238
|
+
<a href="#respond_to%3F-instance_method" title="#respond_to? (instance method)">- (Boolean) <strong>respond_to?</strong>(atom) </a>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
</span>
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
|
257
|
+
<li class="public ">
|
258
|
+
<span class="summary_signature">
|
259
|
+
|
260
|
+
<a href="#to_dict-instance_method" title="#to_dict (instance method)">- (Object) <strong>to_dict</strong>(op = nil) </a>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</span>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
275
|
+
|
276
|
+
</li>
|
277
|
+
|
278
|
+
|
279
|
+
</ul>
|
280
|
+
|
281
|
+
|
282
|
+
<div id="constructor_details" class="method_details_list">
|
283
|
+
<h2>Constructor Details</h2>
|
284
|
+
|
285
|
+
<div class="method_details first">
|
286
|
+
<h3 class="signature first" id="initialize-instance_method">
|
287
|
+
|
288
|
+
- (<tt><span class='object_link'><a href="" title="Bridge::Reference (class)">Reference</a></span></tt>) <strong>initialize</strong>(bridge, address, operations = nil)
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</h3><div class="docstring">
|
295
|
+
<div class="discussion">
|
296
|
+
|
297
|
+
<p>A new instance of Reference</p>
|
298
|
+
|
299
|
+
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
<div class="tags">
|
303
|
+
|
304
|
+
|
305
|
+
</div><table class="source_code">
|
306
|
+
<tr>
|
307
|
+
<td>
|
308
|
+
<pre class="lines">
|
309
|
+
|
310
|
+
|
311
|
+
7
|
312
|
+
8
|
313
|
+
9
|
314
|
+
10
|
315
|
+
11
|
316
|
+
12
|
317
|
+
13
|
318
|
+
14
|
319
|
+
15</pre>
|
320
|
+
</td>
|
321
|
+
<td>
|
322
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 7</span>
|
323
|
+
|
324
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_bridge'>bridge</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='id identifier rubyid_operations'>operations</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
325
|
+
<span class='ivar'>@address</span> <span class='op'>=</span> <span class='id identifier rubyid_address'>address</span>
|
326
|
+
<span class='comment'># Store operations supported by this reference if any
|
327
|
+
</span> <span class='id identifier rubyid_operations'>operations</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_operations'>operations</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
328
|
+
<span class='ivar'>@operations</span> <span class='op'>=</span> <span class='id identifier rubyid_operations'>operations</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_val'>val</span><span class='op'>|</span>
|
329
|
+
<span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
330
|
+
<span class='kw'>end</span>
|
331
|
+
<span class='ivar'>@bridge</span> <span class='op'>=</span> <span class='id identifier rubyid_bridge'>bridge</span>
|
332
|
+
<span class='kw'>end</span></pre>
|
333
|
+
</td>
|
334
|
+
</tr>
|
335
|
+
</table>
|
336
|
+
</div>
|
337
|
+
|
338
|
+
</div>
|
339
|
+
<div id="method_missing_details" class="method_details_list">
|
340
|
+
<h2>Dynamic Method Handling</h2>
|
341
|
+
<p class="notice this">
|
342
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
343
|
+
|
344
|
+
</p>
|
345
|
+
|
346
|
+
<div class="method_details first">
|
347
|
+
<h3 class="signature first" id="method_missing-instance_method">
|
348
|
+
|
349
|
+
- (<tt>Object</tt>) <strong>method_missing</strong>(atom, *args, &blk)
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
</h3><table class="source_code">
|
356
|
+
<tr>
|
357
|
+
<td>
|
358
|
+
<pre class="lines">
|
359
|
+
|
360
|
+
|
361
|
+
34
|
362
|
+
35
|
363
|
+
36
|
364
|
+
37
|
365
|
+
38
|
366
|
+
39
|
367
|
+
40
|
368
|
+
41
|
369
|
+
42</pre>
|
370
|
+
</td>
|
371
|
+
<td>
|
372
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 34</span>
|
373
|
+
|
374
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span> <span class='id identifier rubyid_atom'>atom</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
375
|
+
<span class='comment'># If a block is given, add to arguments list
|
376
|
+
</span> <span class='id identifier rubyid_args'>args</span> <span class='op'><<</span> <span class='id identifier rubyid_blk'>blk</span> <span class='kw'>if</span> <span class='id identifier rubyid_blk'>blk</span>
|
377
|
+
<span class='const'>Util</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Calling </span><span class='embexpr_beg'>#{</span><span class='ivar'>@address</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_atom'>atom</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
378
|
+
<span class='comment'># Serialize destination
|
379
|
+
</span> <span class='id identifier rubyid_destination'>destination</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_dict'>to_dict</span> <span class='id identifier rubyid_atom'>atom</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
380
|
+
<span class='comment'># Send RPC
|
381
|
+
</span> <span class='ivar'>@bridge</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_destination'>destination</span>
|
382
|
+
<span class='kw'>end</span></pre>
|
383
|
+
</td>
|
384
|
+
</tr>
|
385
|
+
</table>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
</div>
|
389
|
+
|
390
|
+
<div id="instance_attr_details" class="attr_details">
|
391
|
+
<h2>Instance Attribute Details</h2>
|
392
|
+
|
393
|
+
|
394
|
+
<span id="address=-instance_method"></span>
|
395
|
+
<div class="method_details first">
|
396
|
+
<h3 class="signature first" id="address-instance_method">
|
397
|
+
|
398
|
+
- (<tt>Object</tt>) <strong>address</strong>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
</h3><div class="docstring">
|
405
|
+
<div class="discussion">
|
406
|
+
|
407
|
+
<p>:nodoc: all</p>
|
408
|
+
|
409
|
+
|
410
|
+
</div>
|
411
|
+
</div>
|
412
|
+
<div class="tags">
|
413
|
+
|
414
|
+
|
415
|
+
</div><table class="source_code">
|
416
|
+
<tr>
|
417
|
+
<td>
|
418
|
+
<pre class="lines">
|
419
|
+
|
420
|
+
|
421
|
+
5
|
422
|
+
6
|
423
|
+
7</pre>
|
424
|
+
</td>
|
425
|
+
<td>
|
426
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 5</span>
|
427
|
+
|
428
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_address'>address</span>
|
429
|
+
<span class='ivar'>@address</span>
|
430
|
+
<span class='kw'>end</span></pre>
|
431
|
+
</td>
|
432
|
+
</tr>
|
433
|
+
</table>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
|
437
|
+
<span id="operations=-instance_method"></span>
|
438
|
+
<div class="method_details ">
|
439
|
+
<h3 class="signature " id="operations-instance_method">
|
440
|
+
|
441
|
+
- (<tt>Object</tt>) <strong>operations</strong>
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
</h3><div class="docstring">
|
448
|
+
<div class="discussion">
|
449
|
+
|
450
|
+
<p>:nodoc: all</p>
|
451
|
+
|
452
|
+
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
<div class="tags">
|
456
|
+
|
457
|
+
|
458
|
+
</div><table class="source_code">
|
459
|
+
<tr>
|
460
|
+
<td>
|
461
|
+
<pre class="lines">
|
462
|
+
|
463
|
+
|
464
|
+
5
|
465
|
+
6
|
466
|
+
7</pre>
|
467
|
+
</td>
|
468
|
+
<td>
|
469
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 5</span>
|
470
|
+
|
471
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_operations'>operations</span>
|
472
|
+
<span class='ivar'>@operations</span>
|
473
|
+
<span class='kw'>end</span></pre>
|
474
|
+
</td>
|
475
|
+
</tr>
|
476
|
+
</table>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</div>
|
480
|
+
|
481
|
+
|
482
|
+
<div id="instance_method_details" class="method_details_list">
|
483
|
+
<h2>Instance Method Details</h2>
|
484
|
+
|
485
|
+
|
486
|
+
<div class="method_details first">
|
487
|
+
<h3 class="signature first" id="respond_to?-instance_method">
|
488
|
+
|
489
|
+
- (<tt>Boolean</tt>) <strong>respond_to?</strong>(atom)
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
</h3><div class="docstring">
|
496
|
+
<div class="discussion">
|
497
|
+
|
498
|
+
|
499
|
+
</div>
|
500
|
+
</div>
|
501
|
+
<div class="tags">
|
502
|
+
|
503
|
+
<p class="tag_title">Returns:</p>
|
504
|
+
<ul class="return">
|
505
|
+
|
506
|
+
<li>
|
507
|
+
|
508
|
+
|
509
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
</li>
|
514
|
+
|
515
|
+
</ul>
|
516
|
+
|
517
|
+
</div><table class="source_code">
|
518
|
+
<tr>
|
519
|
+
<td>
|
520
|
+
<pre class="lines">
|
521
|
+
|
522
|
+
|
523
|
+
44
|
524
|
+
45
|
525
|
+
46</pre>
|
526
|
+
</td>
|
527
|
+
<td>
|
528
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 44</span>
|
529
|
+
|
530
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='id identifier rubyid_atom'>atom</span>
|
531
|
+
<span class='ivar'>@operations</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_atom'>atom</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_atom'>atom</span> <span class='op'>==</span> <span class='symbol'>:to_dict</span> <span class='op'>||</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_atom'>atom</span><span class='rparen'>)</span>
|
532
|
+
<span class='kw'>end</span></pre>
|
533
|
+
</td>
|
534
|
+
</tr>
|
535
|
+
</table>
|
536
|
+
</div>
|
537
|
+
|
538
|
+
<div class="method_details ">
|
539
|
+
<h3 class="signature " id="to_dict-instance_method">
|
540
|
+
|
541
|
+
- (<tt>Object</tt>) <strong>to_dict</strong>(op = nil)
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
</h3><table class="source_code">
|
548
|
+
<tr>
|
549
|
+
<td>
|
550
|
+
<pre class="lines">
|
551
|
+
|
552
|
+
|
553
|
+
17
|
554
|
+
18
|
555
|
+
19
|
556
|
+
20
|
557
|
+
21
|
558
|
+
22
|
559
|
+
23
|
560
|
+
24
|
561
|
+
25
|
562
|
+
26
|
563
|
+
27
|
564
|
+
28
|
565
|
+
29
|
566
|
+
30
|
567
|
+
31
|
568
|
+
32</pre>
|
569
|
+
</td>
|
570
|
+
<td>
|
571
|
+
<pre class="code"><span class="info file"># File 'lib/reference.rb', line 17</span>
|
572
|
+
|
573
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_dict'>to_dict</span> <span class='id identifier rubyid_op'>op</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
574
|
+
<span class='comment'># Serialize the reference
|
575
|
+
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
576
|
+
<span class='id identifier rubyid_address'>address</span> <span class='op'>=</span> <span class='ivar'>@address</span>
|
577
|
+
<span class='comment'># Add a method name to address if given
|
578
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_op'>op</span>
|
579
|
+
<span class='id identifier rubyid_address'>address</span> <span class='op'>=</span> <span class='id identifier rubyid_address'>address</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='int'>0</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span>
|
580
|
+
<span class='id identifier rubyid_address'>address</span> <span class='op'><<</span> <span class='id identifier rubyid_op'>op</span>
|
581
|
+
<span class='kw'>end</span>
|
582
|
+
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='symbol'>:ref</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_address'>address</span>
|
583
|
+
<span class='comment'># Append operations only if address refers to a handler
|
584
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_address'>address</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'><</span> <span class='int'>4</span>
|
585
|
+
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='symbol'>:operations</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@operations</span>
|
586
|
+
<span class='kw'>end</span>
|
587
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
|
588
|
+
<span class='kw'>end</span></pre>
|
589
|
+
</td>
|
590
|
+
</tr>
|
591
|
+
</table>
|
592
|
+
</div>
|
593
|
+
|
594
|
+
</div>
|
595
|
+
|
596
|
+
</div>
|
597
|
+
|
598
|
+
<div id="footer">
|
599
|
+
Generated on Wed Jun 20 11:00:11 2012 by
|
600
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
601
|
+
0.8.2.1 (ruby-1.9.3).
|
602
|
+
</div>
|
603
|
+
|
604
|
+
</body>
|
605
|
+
</html>
|