ionian 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -0
  3. data/doc/Ionian/Extension/IO.html +1062 -599
  4. data/doc/Ionian/Extension/Socket.html +2140 -1314
  5. data/doc/Ionian/Extension.html +98 -70
  6. data/doc/Ionian/Server.html +577 -345
  7. data/doc/Ionian/Socket.html +1100 -612
  8. data/doc/Ionian.html +100 -70
  9. data/doc/_index.html +164 -0
  10. data/doc/class_list.html +54 -0
  11. data/doc/css/common.css +1 -0
  12. data/doc/css/full_list.css +57 -0
  13. data/doc/css/style.css +338 -0
  14. data/doc/file.README.html +133 -0
  15. data/doc/file.license.html +73 -0
  16. data/doc/file_list.html +59 -0
  17. data/doc/frames.html +26 -0
  18. data/doc/index.html +111 -71
  19. data/doc/js/app.js +219 -0
  20. data/doc/js/full_list.js +178 -0
  21. data/doc/js/jquery.js +4 -18
  22. data/doc/method_list.html +419 -0
  23. data/doc/top-level-namespace.html +112 -0
  24. data/lib/ionian/extension/io.rb +4 -2
  25. data/lib/ionian/socket.rb +1 -1
  26. data/license.txt +2 -0
  27. metadata +28 -54
  28. data/doc/created.rid +0 -6
  29. data/doc/fonts/Lato-Light.ttf +0 -0
  30. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  31. data/doc/fonts/Lato-Regular.ttf +0 -0
  32. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  33. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  34. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  35. data/doc/fonts.css +0 -167
  36. data/doc/images/add.png +0 -0
  37. data/doc/images/arrow_up.png +0 -0
  38. data/doc/images/brick.png +0 -0
  39. data/doc/images/brick_link.png +0 -0
  40. data/doc/images/bug.png +0 -0
  41. data/doc/images/bullet_black.png +0 -0
  42. data/doc/images/bullet_toggle_minus.png +0 -0
  43. data/doc/images/bullet_toggle_plus.png +0 -0
  44. data/doc/images/date.png +0 -0
  45. data/doc/images/delete.png +0 -0
  46. data/doc/images/find.png +0 -0
  47. data/doc/images/loadingAnimation.gif +0 -0
  48. data/doc/images/macFFBgHack.png +0 -0
  49. data/doc/images/package.png +0 -0
  50. data/doc/images/page_green.png +0 -0
  51. data/doc/images/page_white_text.png +0 -0
  52. data/doc/images/page_white_width.png +0 -0
  53. data/doc/images/plugin.png +0 -0
  54. data/doc/images/ruby.png +0 -0
  55. data/doc/images/tag_blue.png +0 -0
  56. data/doc/images/tag_green.png +0 -0
  57. data/doc/images/transparent.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/js/darkfish.js +0 -140
  62. data/doc/js/navigation.js +0 -142
  63. data/doc/js/search.js +0 -109
  64. data/doc/js/search_index.js +0 -1
  65. data/doc/js/searcher.js +0 -228
  66. data/doc/rdoc.css +0 -580
  67. data/doc/table_of_contents.html +0 -402
@@ -1,438 +1,670 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
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: Ionian::Server
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
6
12
 
7
- <title>class Ionian::Server - RDoc Documentation</title>
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
8
14
 
9
- <link href="../fonts.css" rel="stylesheet">
10
- <link href="../rdoc.css" rel="stylesheet">
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
11
16
 
12
- <script type="text/javascript">
13
- var rdoc_rel_prefix = "../";
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);
14
21
  </script>
15
22
 
16
- <script src="../js/jquery.js"></script>
17
- <script src="../js/navigation.js"></script>
18
- <script src="../js/search_index.js"></script>
19
- <script src="../js/search.js"></script>
20
- <script src="../js/searcher.js"></script>
21
- <script src="../js/darkfish.js"></script>
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="../index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="../table_of_contents.html#pages">Pages</a>
34
- <a href="../table_of_contents.html#classes">Classes</a>
35
- <a href="../table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
23
 
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search" spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
47
25
 
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
53
27
 
54
- </div>
55
28
 
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (S)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Ionian.html" title="Ionian (module)">Ionian</a></span></span>
36
+ &raquo;
37
+ <span class="title">Server</span>
56
38
 
57
39
 
58
- <div id="class-metadata">
59
-
60
- <div id="parent-class-section" class="nav-section">
61
- <h3>Parent</h3>
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
62
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>
63
54
 
64
- <p class="link">Object
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
65
59
 
66
60
  </div>
61
+ <div class="clear"></div>
62
+ </div>
67
63
 
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
64
+ <iframe id="search_frame"></iframe>
73
65
 
74
- <ul class="link-list" role="directory">
75
-
76
- <li ><a href="#method-c-new">::new</a>
66
+ <div id="content"><h1>Class: Ionian::Server
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">Ionian::Server</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
77
87
 
78
- <li ><a href="#method-i-close">#close</a>
88
+
89
+
79
90
 
80
- <li ><a href="#method-i-closed-3F">#closed?</a>
91
+
81
92
 
82
- <li ><a href="#method-i-listen">#listen</a>
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/ionian/server.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
83
104
 
84
- <li ><a href="#method-i-on_accept">#on_accept</a>
105
+ <p>A convenient wrapper for TCP, UDP, and Unix server sockets.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ <h2>
122
+ Instance Method Summary
123
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
124
+ </h2>
125
+
126
+ <ul class="summary">
127
+
128
+ <li class="public ">
129
+ <span class="summary_signature">
85
130
 
86
- <li ><a href="#method-i-register_accept_listener">#register_accept_listener</a>
131
+ <a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong> </a>
87
132
 
88
- <li ><a href="#method-i-unregister_accept_listener">#unregister_accept_listener</a>
133
+
89
134
 
90
- </ul>
91
- </div>
135
+ </span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
92
143
 
93
- </div>
94
- </nav>
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>Shutdown the server socket and stop listening for connections.</p>
147
+ </div></span>
148
+
149
+ </li>
95
150
 
96
- <main role="main" aria-labelledby="class-Ionian::Server">
97
- <h1 id="class-Ionian::Server" class="class">
98
- class Ionian::Server
99
- </h1>
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#closed%3F-instance_method" title="#closed? (instance method)">- (Boolean) <strong>closed?</strong> </a>
156
+
100
157
 
101
- <section class="description">
102
158
 
103
- <p>A convenient wrapper for TCP, UDP, and Unix server sockets.</p>
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
104
167
 
105
- </section>
168
+
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Returns true if the server listener socket is closed.</p>
171
+ </div></span>
172
+
173
+ </li>
174
+
175
+
176
+ <li class="public ">
177
+ <span class="summary_signature">
178
+
179
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Server) <strong>initialize</strong>(**kwargs, &amp;block) </a>
180
+
106
181
 
182
+
183
+ </span>
184
+
185
+
186
+ <span class="note title constructor">constructor</span>
107
187
 
108
188
 
109
189
 
110
- <section id="5Buntitled-5D" class="documentation-section">
190
+
191
+
192
+
193
+
194
+
195
+ <span class="summary_desc"><div class='inline'>
196
+ <p>A convenient wrapper for TCP and Unix server sockets (UDP doesn&#39;t use a
197
+ server).</p>
198
+ </div></span>
199
+
200
+ </li>
201
+
202
+
203
+ <li class="public ">
204
+ <span class="summary_signature">
205
+
206
+ <a href="#listen-instance_method" title="#listen (instance method)">- (Object) <strong>listen</strong>(&amp;block) </a>
111
207
 
112
208
 
113
209
 
210
+ </span>
211
+
212
+
213
+
214
+
215
+
216
+
217
+
114
218
 
219
+
220
+ <span class="summary_desc"><div class='inline'>
221
+ <p>Starts the socket server listening for connections.</p>
222
+ </div></span>
223
+
224
+ </li>
225
+
226
+
227
+ <li class="public ">
228
+ <span class="summary_signature">
229
+
230
+ <a href="#register_accept_listener-instance_method" title="#register_accept_listener (instance method)">- (Object) <strong>register_accept_listener</strong>(&amp;block) </a>
115
231
 
116
232
 
117
233
 
234
+ (also: #on_accept)
235
+
236
+ </span>
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+ <span class="summary_desc"><div class='inline'>
247
+ <p>Register a block to be run when server accepts a client connection.</p>
248
+ </div></span>
249
+
250
+ </li>
118
251
 
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#unregister_accept_listener-instance_method" title="#unregister_accept_listener (instance method)">- (Object) <strong>unregister_accept_listener</strong>(proc) </a>
119
257
 
120
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
121
- <header>
122
- <h3>Public Class Methods</h3>
123
- </header>
124
258
 
125
259
 
126
- <div id="method-c-new" class="method-detail ">
127
-
128
- <div class="method-heading">
129
- <span class="method-name">new</span><span
130
- class="method-args">(**kwargs, &block)</span>
131
-
132
- <span class="method-click-advice">click to toggle source</span>
133
-
134
- </div>
135
-
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
136
268
 
137
- <div class="method-description">
138
-
139
- <p>A convenient wrapper for TCP and Unix server sockets (UDP doesn&#39;t use a
269
+
270
+ <span class="summary_desc"><div class='inline'>
271
+ <p>Unregisters a socket accept notifier block.</p>
272
+ </div></span>
273
+
274
+ </li>
275
+
276
+
277
+ </ul>
278
+
279
+
280
+ <div id="constructor_details" class="method_details_list">
281
+ <h2>Constructor Details</h2>
282
+
283
+ <div class="method_details first">
284
+ <h3 class="signature first" id="initialize-instance_method">
285
+
286
+ - (<tt><span class='object_link'><a href="" title="Ionian::Server (class)">Server</a></span></tt>) <strong>initialize</strong>(**kwargs, &amp;block)
287
+
288
+
289
+
290
+
291
+
292
+ </h3><div class="docstring">
293
+ <div class="discussion">
294
+
295
+ <p>A convenient wrapper for TCP and Unix server sockets (UDP doesn&#39;t use a
140
296
  server).</p>
141
297
 
142
- <p>Accepts an optional block that is passed to <a
143
- href="Server.html#method-i-register_accept_listener">register_accept_listener</a>.
144
- <a href="Server.html">Server</a> opens listening socket on instantiation if
145
- this block is provided.</p>
298
+ <p>Accepts an optional block that is passed to #register_accept_listener.
299
+ Server opens listening socket on instantiation if this block is provided.</p>
146
300
 
147
301
  <p>Args:</p>
148
302
 
149
- <pre>interface: The address of the network interface to bind to.
303
+ <pre class="code ruby"><code class="ruby">interface: The address of the network interface to bind to.
150
304
  Defaults to all.
151
- protocol: :tcp, :unix. Default is :tcp.</pre>
152
-
153
-
154
-
155
-
156
- <div class="method-source-code" id="new-source">
157
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 19</span>
158
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
159
- <span class="ruby-ivar">@accept_listeners</span> = []
160
- <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
161
-
162
- <span class="ruby-ivar">@interface</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:interface</span>, <span class="ruby-string">&#39;&#39;</span>
163
- <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:port</span>, <span class="ruby-keyword">nil</span>
164
-
165
-
166
- <span class="ruby-comment"># Automatically select UDP for the multicast range. Otherwise default to TCP.</span>
167
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:tcp</span>
168
- <span class="ruby-comment"># TODO: This ivar may be incorrect for UDP -- bound interface is not destination.</span>
169
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:udp</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Ionian</span><span class="ruby-operator">::</span><span class="ruby-constant">Extension</span><span class="ruby-operator">::</span><span class="ruby-constant">Socket</span>.<span class="ruby-identifier">multicast?</span> <span class="ruby-ivar">@interface</span>
170
- <span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:unix</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@interface</span>.<span class="ruby-identifier">start_with?</span> <span class="ruby-string">&#39;/&#39;</span>
171
-
172
- <span class="ruby-ivar">@protocol</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:protocol</span>, <span class="ruby-identifier">default_protocol</span>
173
-
174
- <span class="ruby-comment"># TODO: Move this to #listen.</span>
175
- <span class="ruby-keyword">case</span> <span class="ruby-ivar">@protocol</span>
176
- <span class="ruby-keyword">when</span> <span class="ruby-value">:tcp</span>
177
- <span class="ruby-ivar">@server</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@interface</span>, <span class="ruby-ivar">@port</span>
178
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">setsockopt</span> <span class="ruby-operator">::</span><span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">SOL_SOCKET</span>, <span class="ruby-operator">::</span><span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">SO_REUSEADDR</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&#39;i&#39;</span>)
179
- <span class="ruby-keyword">when</span> <span class="ruby-value">:udp</span>
180
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;UDP should be implemented with Ionian::Socket.&quot;</span>
181
- <span class="ruby-keyword">when</span> <span class="ruby-value">:unix</span>
182
- <span class="ruby-ivar">@server</span> = <span class="ruby-constant">UNIXServer</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@interface</span>
183
- <span class="ruby-keyword">end</span>
184
-
185
- <span class="ruby-identifier">listen</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
186
- <span class="ruby-keyword">end</span></pre>
187
- </div>
188
-
189
- </div>
305
+ protocol: :tcp, :unix. Default is :tcp.</code></pre>
190
306
 
191
-
192
307
 
193
-
194
- </div>
195
-
196
-
197
- </section>
308
+ </div>
309
+ </div>
310
+ <div class="tags">
198
311
 
199
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
200
- <header>
201
- <h3>Public Instance Methods</h3>
202
- </header>
203
312
 
204
-
205
- <div id="method-i-close" class="method-detail ">
206
-
207
- <div class="method-heading">
208
- <span class="method-name">close</span><span
209
- class="method-args">()</span>
210
-
211
- <span class="method-click-advice">click to toggle source</span>
212
-
213
- </div>
214
-
313
+ </div><table class="source_code">
314
+ <tr>
315
+ <td>
316
+ <pre class="lines">
317
+
318
+
319
+ 19
320
+ 20
321
+ 21
322
+ 22
323
+ 23
324
+ 24
325
+ 25
326
+ 26
327
+ 27
328
+ 28
329
+ 29
330
+ 30
331
+ 31
332
+ 32
333
+ 33
334
+ 34
335
+ 35
336
+ 36
337
+ 37
338
+ 38
339
+ 39
340
+ 40
341
+ 41
342
+ 42
343
+ 43
344
+ 44
345
+ 45
346
+ 46
347
+ 47</pre>
348
+ </td>
349
+ <td>
350
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 19</span>
351
+
352
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
353
+ <span class='ivar'>@accept_listeners</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
354
+ <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
355
+
356
+ <span class='ivar'>@interface</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:interface</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
357
+ <span class='ivar'>@port</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:port</span><span class='comma'>,</span> <span class='kw'>nil</span>
358
+
359
+
360
+ <span class='comment'># Automatically select UDP for the multicast range. Otherwise default to TCP.
361
+ </span> <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:tcp</span>
362
+ <span class='comment'># TODO: This ivar may be incorrect for UDP -- bound interface is not destination.
363
+ </span> <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:udp</span> <span class='kw'>if</span> <span class='const'>Ionian</span><span class='op'>::</span><span class='const'>Extension</span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_multicast?'>multicast?</span> <span class='ivar'>@interface</span>
364
+ <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:unix</span> <span class='kw'>if</span> <span class='ivar'>@interface</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span>
365
+
366
+ <span class='ivar'>@protocol</span> <span class='op'>=</span> <span class='id identifier rubyid_kwargs'>kwargs</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='symbol'>:protocol</span><span class='comma'>,</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span>
367
+
368
+ <span class='comment'># TODO: Move this to #listen.
369
+ </span> <span class='kw'>case</span> <span class='ivar'>@protocol</span>
370
+ <span class='kw'>when</span> <span class='symbol'>:tcp</span>
371
+ <span class='ivar'>@server</span> <span class='op'>=</span> <span class='const'>TCPServer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@interface</span><span class='comma'>,</span> <span class='ivar'>@port</span>
372
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_setsockopt'>setsockopt</span> <span class='op'>::</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>SOL_SOCKET</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>SO_REUSEADDR</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_pack'>pack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>i</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
373
+ <span class='kw'>when</span> <span class='symbol'>:udp</span>
374
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UDP should be implemented with Ionian::Socket.</span><span class='tstring_end'>&quot;</span></span>
375
+ <span class='kw'>when</span> <span class='symbol'>:unix</span>
376
+ <span class='ivar'>@server</span> <span class='op'>=</span> <span class='const'>UNIXServer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@interface</span>
377
+ <span class='kw'>end</span>
378
+
379
+ <span class='id identifier rubyid_listen'>listen</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
380
+ <span class='kw'>end</span></pre>
381
+ </td>
382
+ </tr>
383
+ </table>
384
+ </div>
385
+
386
+ </div>
215
387
 
216
- <div class="method-description">
217
-
218
- <p>Shutdown the server socket and stop listening for connections.</p>
219
-
220
-
221
388
 
222
-
223
- <div class="method-source-code" id="close-source">
224
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 74</span>
225
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>
226
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@server</span>
227
- <span class="ruby-ivar">@accept_thread</span>.<span class="ruby-identifier">join</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@accept_thread</span>
228
- <span class="ruby-ivar">@accept_thread</span> = <span class="ruby-keyword">nil</span>
229
- <span class="ruby-keyword">end</span></pre>
230
- </div>
231
-
232
- </div>
389
+ <div id="instance_method_details" class="method_details_list">
390
+ <h2>Instance Method Details</h2>
233
391
 
234
-
392
+
393
+ <div class="method_details first">
394
+ <h3 class="signature first" id="close-instance_method">
395
+
396
+ - (<tt>Object</tt>) <strong>close</strong>
397
+
235
398
 
236
-
237
- </div>
399
+
238
400
 
401
+
402
+ </h3><div class="docstring">
403
+ <div class="discussion">
239
404
 
240
- <div id="method-i-closed-3F" class="method-detail ">
241
-
242
- <div class="method-heading">
243
- <span class="method-name">closed?</span><span
244
- class="method-args">()</span>
245
-
246
- <span class="method-click-advice">click to toggle source</span>
247
-
248
- </div>
249
-
405
+ <p>Shutdown the server socket and stop listening for connections.</p>
250
406
 
251
- <div class="method-description">
252
-
253
- <p>Returns true if the server listener socket is closed.</p>
254
-
255
-
256
407
 
257
-
258
- <div class="method-source-code" id="closed-3F-source">
259
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 81</span>
260
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">closed?</span>
261
- <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">closed?</span>
262
- <span class="ruby-keyword">end</span></pre>
263
- </div>
264
-
265
- </div>
408
+ </div>
409
+ </div>
410
+ <div class="tags">
411
+
266
412
 
267
-
413
+ </div><table class="source_code">
414
+ <tr>
415
+ <td>
416
+ <pre class="lines">
417
+
418
+
419
+ 74
420
+ 75
421
+ 76
422
+ 77
423
+ 78</pre>
424
+ </td>
425
+ <td>
426
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 74</span>
427
+
428
+ <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
429
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span> <span class='kw'>if</span> <span class='ivar'>@server</span>
430
+ <span class='ivar'>@accept_thread</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='kw'>if</span> <span class='ivar'>@accept_thread</span>
431
+ <span class='ivar'>@accept_thread</span> <span class='op'>=</span> <span class='kw'>nil</span>
432
+ <span class='kw'>end</span></pre>
433
+ </td>
434
+ </tr>
435
+ </table>
436
+ </div>
437
+
438
+ <div class="method_details ">
439
+ <h3 class="signature " id="closed?-instance_method">
440
+
441
+ - (<tt>Boolean</tt>) <strong>closed?</strong>
442
+
268
443
 
269
-
270
- </div>
444
+
271
445
 
446
+
447
+ </h3><div class="docstring">
448
+ <div class="discussion">
272
449
 
273
- <div id="method-i-listen" class="method-detail ">
274
-
275
- <div class="method-heading">
276
- <span class="method-name">listen</span><span
277
- class="method-args">(&block)</span>
278
-
279
- <span class="method-click-advice">click to toggle source</span>
280
-
281
- </div>
282
-
450
+ <p>Returns true if the server listener socket is closed.</p>
283
451
 
284
- <div class="method-description">
285
-
286
- <p>Starts the socket server listening for connections. Blocks registered with
287
- <a
288
- href="Server.html#method-i-register_accept_listener">register_accept_listener</a>
289
- will be run when a connection is accepted.</p>
290
-
291
-
292
452
 
293
-
294
- <div class="method-source-code" id="listen-source">
295
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 52</span>
296
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">listen</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
297
- <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
298
-
299
- <span class="ruby-ivar">@accept_thread</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
300
- <span class="ruby-comment"># Package in an Ionian::Socket</span>
301
- <span class="ruby-keyword">begin</span>
302
- <span class="ruby-identifier">client</span> = <span class="ruby-constant">Ionian</span><span class="ruby-operator">::</span><span class="ruby-constant">Socket</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">accept</span>
453
+ </div>
454
+ </div>
455
+ <div class="tags">
456
+
457
+ <p class="tag_title">Returns:</p>
458
+ <ul class="return">
459
+
460
+ <li>
303
461
 
304
- <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">listener</span><span class="ruby-operator">|</span>
305
- <span class="ruby-identifier">listener</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">client</span>
306
- <span class="ruby-keyword">end</span>
307
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EBADF</span>
308
- <span class="ruby-comment"># This ignores the connection if the client closed it before it</span>
309
- <span class="ruby-comment"># could be accepted.</span>
310
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">IOError</span>
311
- <span class="ruby-comment"># This ignores the connection if the client closed it before it</span>
312
- <span class="ruby-comment"># could be accepted.</span>
313
- <span class="ruby-keyword">end</span>
314
- <span class="ruby-keyword">end</span>
315
- <span class="ruby-keyword">end</span></pre>
316
- </div>
317
-
318
- </div>
319
-
320
-
462
+
463
+ <span class='type'>(<tt>Boolean</tt>)</span>
464
+
465
+
466
+
467
+ </li>
468
+
469
+ </ul>
470
+
471
+ </div><table class="source_code">
472
+ <tr>
473
+ <td>
474
+ <pre class="lines">
475
+
476
+
477
+ 81
478
+ 82
479
+ 83</pre>
480
+ </td>
481
+ <td>
482
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 81</span>
483
+
484
+ <span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
485
+ <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
486
+ <span class='kw'>end</span></pre>
487
+ </td>
488
+ </tr>
489
+ </table>
490
+ </div>
491
+
492
+ <div class="method_details ">
493
+ <h3 class="signature " id="listen-instance_method">
494
+
495
+ - (<tt>Object</tt>) <strong>listen</strong>(&amp;block)
496
+
321
497
 
322
-
323
- </div>
498
+
324
499
 
500
+
501
+ </h3><div class="docstring">
502
+ <div class="discussion">
325
503
 
326
- <div id="method-i-on_accept" class="method-detail method-alias">
327
-
328
- <div class="method-heading">
329
- <span class="method-name">on_accept</span><span
330
- class="method-args">(&block)</span>
331
-
332
- </div>
333
-
504
+ <p>Starts the socket server listening for connections. Blocks registered with
505
+ #register_accept_listener will be run when a connection is accepted.</p>
334
506
 
335
- <div class="method-description">
336
-
337
-
338
-
339
-
340
507
 
341
-
342
- </div>
508
+ </div>
509
+ </div>
510
+ <div class="tags">
511
+
343
512
 
344
-
513
+ </div><table class="source_code">
514
+ <tr>
515
+ <td>
516
+ <pre class="lines">
517
+
518
+
519
+ 52
520
+ 53
521
+ 54
522
+ 55
523
+ 56
524
+ 57
525
+ 58
526
+ 59
527
+ 60
528
+ 61
529
+ 62
530
+ 63
531
+ 64
532
+ 65
533
+ 66
534
+ 67
535
+ 68
536
+ 69
537
+ 70
538
+ 71</pre>
539
+ </td>
540
+ <td>
541
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 52</span>
542
+
543
+ <span class='kw'>def</span> <span class='id identifier rubyid_listen'>listen</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
544
+ <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
545
+
546
+ <span class='ivar'>@accept_thread</span> <span class='op'>||=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
547
+ <span class='comment'># Package in an Ionian::Socket
548
+ </span> <span class='kw'>begin</span>
549
+ <span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'>Ionian</span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='ivar'>@server</span><span class='period'>.</span><span class='id identifier rubyid_accept'>accept</span>
550
+
551
+ <span class='ivar'>@accept_listeners</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_listener'>listener</span><span class='op'>|</span>
552
+ <span class='id identifier rubyid_listener'>listener</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_client'>client</span>
553
+ <span class='kw'>end</span>
554
+ <span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>EBADF</span>
555
+ <span class='comment'># This ignores the connection if the client closed it before it
556
+ </span> <span class='comment'># could be accepted.
557
+ </span> <span class='kw'>rescue</span> <span class='const'>IOError</span>
558
+ <span class='comment'># This ignores the connection if the client closed it before it
559
+ </span> <span class='comment'># could be accepted.
560
+ </span> <span class='kw'>end</span>
561
+ <span class='kw'>end</span>
562
+ <span class='kw'>end</span></pre>
563
+ </td>
564
+ </tr>
565
+ </table>
566
+ </div>
567
+
568
+ <div class="method_details ">
569
+ <h3 class="signature " id="register_accept_listener-instance_method">
570
+
571
+ - (<tt>Object</tt>) <strong>register_accept_listener</strong>(&amp;block)
572
+
345
573
 
346
-
347
- <div class="aliases">
348
- Alias for: <a href="Server.html#method-i-register_accept_listener">register_accept_listener</a>
349
- </div>
350
-
351
- </div>
574
+
575
+ <span class="aliases">Also known as:
576
+ <span class="names"><span id='on_accept-instance_method'>on_accept</span></span>
577
+ </span>
578
+
352
579
 
580
+
581
+ </h3><div class="docstring">
582
+ <div class="discussion">
353
583
 
354
- <div id="method-i-register_accept_listener" class="method-detail ">
355
-
356
- <div class="method-heading">
357
- <span class="method-name">register_accept_listener</span><span
358
- class="method-args">(&block)</span>
359
-
360
- <span class="method-click-advice">click to toggle source</span>
361
-
362
- </div>
363
-
364
-
365
- <div class="method-description">
366
-
367
- <p>Register a block to be run when server accepts a client connection. The
584
+ <p>Register a block to be run when server accepts a client connection. The
368
585
  connected client is passed to the block as an Ionain::Client.</p>
369
-
370
-
371
-
372
-
373
- <div class="method-source-code" id="register_accept_listener-source">
374
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 87</span>
375
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">register_accept_listener</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
376
- <span class="ruby-ivar">@accept_listeners</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">block</span>
377
- <span class="ruby-identifier">block</span>
378
- <span class="ruby-keyword">end</span></pre>
379
- </div>
380
-
381
- </div>
382
586
 
383
-
384
- <div class="aliases">
385
- Also aliased as: <a href="Server.html#method-i-on_accept">on_accept</a>
386
- </div>
387
-
388
587
 
389
-
390
- </div>
588
+ </div>
589
+ </div>
590
+ <div class="tags">
591
+
391
592
 
593
+ </div><table class="source_code">
594
+ <tr>
595
+ <td>
596
+ <pre class="lines">
597
+
598
+
599
+ 87
600
+ 88
601
+ 89
602
+ 90</pre>
603
+ </td>
604
+ <td>
605
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 87</span>
606
+
607
+ <span class='kw'>def</span> <span class='id identifier rubyid_register_accept_listener'>register_accept_listener</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
608
+ <span class='ivar'>@accept_listeners</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_block'>block</span> <span class='kw'>unless</span> <span class='ivar'>@accept_listeners</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_block'>block</span>
609
+ <span class='id identifier rubyid_block'>block</span>
610
+ <span class='kw'>end</span></pre>
611
+ </td>
612
+ </tr>
613
+ </table>
614
+ </div>
392
615
 
393
- <div id="method-i-unregister_accept_listener" class="method-detail ">
394
-
395
- <div class="method-heading">
396
- <span class="method-name">unregister_accept_listener</span><span
397
- class="method-args">(proc)</span>
398
-
399
- <span class="method-click-advice">click to toggle source</span>
400
-
401
- </div>
402
-
616
+ <div class="method_details ">
617
+ <h3 class="signature " id="unregister_accept_listener-instance_method">
618
+
619
+ - (<tt>Object</tt>) <strong>unregister_accept_listener</strong>(proc)
620
+
403
621
 
404
- <div class="method-description">
405
-
406
- <p>Unregisters a socket accept notifier block.</p>
407
-
408
-
622
+
409
623
 
410
-
411
- <div class="method-source-code" id="unregister_accept_listener-source">
412
- <pre><span class="ruby-comment"># File lib/ionian/server.rb, line 95</span>
413
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">unregister_accept_listener</span> <span class="ruby-identifier">proc</span>
414
- <span class="ruby-ivar">@accept_listeners</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">o</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">proc</span>}
415
- <span class="ruby-identifier">proc</span>
416
- <span class="ruby-keyword">end</span></pre>
417
- </div>
418
-
419
- </div>
624
+
625
+ </h3><div class="docstring">
626
+ <div class="discussion">
627
+
628
+ <p>Unregisters a socket accept notifier block.</p>
420
629
 
421
-
422
630
 
423
-
424
- </div>
631
+ </div>
632
+ </div>
633
+ <div class="tags">
634
+
425
635
 
636
+ </div><table class="source_code">
637
+ <tr>
638
+ <td>
639
+ <pre class="lines">
640
+
641
+
642
+ 95
643
+ 96
644
+ 97
645
+ 98</pre>
646
+ </td>
647
+ <td>
648
+ <pre class="code"><span class="info file"># File 'lib/ionian/server.rb', line 95</span>
649
+
650
+ <span class='kw'>def</span> <span class='id identifier rubyid_unregister_accept_listener'>unregister_accept_listener</span> <span class='id identifier rubyid_proc'>proc</span>
651
+ <span class='ivar'>@accept_listeners</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='id identifier rubyid_o'>o</span> <span class='op'>==</span> <span class='id identifier rubyid_proc'>proc</span><span class='rbrace'>}</span>
652
+ <span class='id identifier rubyid_proc'>proc</span>
653
+ <span class='kw'>end</span></pre>
654
+ </td>
655
+ </tr>
656
+ </table>
657
+ </div>
426
658
 
427
- </section>
428
-
429
- </section>
430
- </main>
659
+ </div>
431
660
 
661
+ </div>
432
662
 
433
- <footer id="validator-badges" role="contentinfo">
434
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
435
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
436
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
437
- </footer>
663
+ <div id="footer">
664
+ Generated on Sat Mar 15 21:04:54 2014 by
665
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
666
+ 0.8.7.3 (ruby-2.1.1).
667
+ </div>
438
668
 
669
+ </body>
670
+ </html>