ionian 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/Ionian/Extension/IO.html +48 -13
- data/doc/Ionian/Extension/Socket.html +6 -7
- data/doc/Ionian/Extension.html +6 -7
- data/doc/Ionian/Server.html +389 -0
- data/doc/Ionian/Socket.html +221 -55
- data/doc/Ionian.html +6 -7
- data/doc/created.rid +5 -4
- data/doc/index.html +8 -7
- data/doc/js/search.js +8 -1
- data/doc/js/search_index.js +1 -1
- data/doc/rdoc.css +9 -3
- data/doc/table_of_contents.html +55 -7
- data/lib/ionian/extension/io.rb +7 -1
- data/lib/ionian/server.rb +85 -0
- data/lib/ionian/socket.rb +80 -22
- data/lib/ionian.rb +1 -0
- metadata +52 -50
data/doc/Ionian/Socket.html
CHANGED
@@ -24,16 +24,16 @@
|
|
24
24
|
<body id="top" role="document" class="class">
|
25
25
|
<nav role="navigation">
|
26
26
|
<div id="project-navigation">
|
27
|
-
<div id="home-section" role="
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
28
|
<h2>
|
29
29
|
<a href="../index.html" rel="home">Home</a>
|
30
30
|
</h2>
|
31
31
|
|
32
|
-
<
|
32
|
+
<div id="table-of-contents-navigation">
|
33
33
|
<a href="../table_of_contents.html#pages">Pages</a>
|
34
34
|
<a href="../table_of_contents.html#classes">Classes</a>
|
35
35
|
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
-
</
|
36
|
+
</div>
|
37
37
|
</div>
|
38
38
|
|
39
39
|
<div id="search-section" role="search" class="project-section initially-hidden">
|
@@ -41,14 +41,13 @@
|
|
41
41
|
<div id="search-field-wrapper">
|
42
42
|
<input id="search-field" role="combobox" aria-label="Search"
|
43
43
|
aria-autocomplete="list" aria-controls="search-results"
|
44
|
-
type="text" name="search" placeholder="Search"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
46
46
|
</div>
|
47
47
|
|
48
48
|
<ul id="search-results" aria-label="Search Results"
|
49
49
|
aria-busy="false" aria-expanded="false"
|
50
|
-
aria-atomic="false"
|
51
|
-
aria-relevant="all" class="initially-hidden"></ul>
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
52
51
|
</form>
|
53
52
|
</div>
|
54
53
|
|
@@ -73,6 +72,14 @@
|
|
73
72
|
<ul class="link-list">
|
74
73
|
|
75
74
|
|
75
|
+
<li><a class="extend" href="Extension/IO.html">Ionian::Extension::IO</a>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<li><a class="extend" href="Extension/Socket.html">Ionian::Extension::Socket</a>
|
80
|
+
|
81
|
+
|
82
|
+
|
76
83
|
<li><a class="extend" href="Extension/Socket.html">Ionian::Extension::Socket</a>
|
77
84
|
|
78
85
|
|
@@ -105,12 +112,16 @@
|
|
105
112
|
|
106
113
|
<li ><a href="#method-i-has_data-3F">#has_data?</a>
|
107
114
|
|
108
|
-
<li ><a href="#method-i-
|
115
|
+
<li ><a href="#method-i-on_match">#on_match</a>
|
109
116
|
|
110
|
-
<li ><a href="#method-i-
|
117
|
+
<li ><a href="#method-i-persistent-3F">#persistent?</a>
|
111
118
|
|
112
119
|
<li ><a href="#method-i-puts">#puts</a>
|
113
120
|
|
121
|
+
<li ><a href="#method-i-register_observer">#register_observer</a>
|
122
|
+
|
123
|
+
<li ><a href="#method-i-unregister_observer">#unregister_observer</a>
|
124
|
+
|
114
125
|
<li ><a href="#method-i-write">#write</a>
|
115
126
|
|
116
127
|
</ul>
|
@@ -126,7 +137,7 @@
|
|
126
137
|
|
127
138
|
<section class="description">
|
128
139
|
|
129
|
-
<p>A convenient wrapper for TCP, UDP, and Unix sockets.</p>
|
140
|
+
<p>A convenient wrapper for TCP, UDP, and Unix client sockets.</p>
|
130
141
|
|
131
142
|
</section>
|
132
143
|
|
@@ -141,6 +152,55 @@
|
|
141
152
|
|
142
153
|
|
143
154
|
|
155
|
+
<section class="attribute-method-details" class="method-section">
|
156
|
+
<header>
|
157
|
+
<h3>Attributes</h3>
|
158
|
+
</header>
|
159
|
+
|
160
|
+
|
161
|
+
<div id="attribute-i-expression" class="method-detail">
|
162
|
+
<div class="method-heading attribute-method-heading">
|
163
|
+
<span class="method-name">expression</span><span
|
164
|
+
class="attribute-access-type">[RW]</span>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div id="attribute-i-protocol" class="method-detail">
|
175
|
+
<div class="method-heading attribute-method-heading">
|
176
|
+
<span class="method-name">protocol</span><span
|
177
|
+
class="attribute-access-type">[R]</span>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
|
182
|
+
<p>Returns a symbol of the type of protocol this socket uses: :tcp, :udp,
|
183
|
+
:unix</p>
|
184
|
+
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div id="attribute-i-protocol-3F" class="method-detail">
|
189
|
+
<div class="method-heading attribute-method-heading">
|
190
|
+
<span class="method-name">protocol?</span><span
|
191
|
+
class="attribute-access-type">[R]</span>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
|
196
|
+
<p>Returns a symbol of the type of protocol this socket uses: :tcp, :udp,
|
197
|
+
:unix</p>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</section>
|
203
|
+
|
144
204
|
|
145
205
|
|
146
206
|
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
@@ -153,7 +213,7 @@
|
|
153
213
|
|
154
214
|
<div class="method-heading">
|
155
215
|
<span class="method-name">new</span><span
|
156
|
-
class="method-args">(**kwargs)</span>
|
216
|
+
class="method-args">(existing_socket = nil, **kwargs)</span>
|
157
217
|
|
158
218
|
<span class="method-click-advice">click to toggle source</span>
|
159
219
|
|
@@ -162,7 +222,9 @@
|
|
162
222
|
|
163
223
|
<div class="method-description">
|
164
224
|
|
165
|
-
<p>
|
225
|
+
<p>Creates a new socket or wraps an existing socket.</p>
|
226
|
+
|
227
|
+
<p>Args:</p>
|
166
228
|
|
167
229
|
<pre>host: IP or hostname to connect to.
|
168
230
|
port: Connection's port number. Default is 23. Unused by :unix protocol.
|
@@ -183,31 +245,65 @@ expression: Overrides the #read_match regular expression for received data.</pre
|
|
183
245
|
|
184
246
|
|
185
247
|
<div class="method-source-code" id="new-source">
|
186
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
187
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>)
|
188
|
-
<span class="ruby-ivar">@socket</span>
|
248
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 26</span>
|
249
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">existing_socket</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>)
|
250
|
+
<span class="ruby-ivar">@socket</span> = <span class="ruby-identifier">existing_socket</span>
|
189
251
|
|
190
|
-
<span class="ruby-
|
191
|
-
<span class="ruby-comment"># :port should override this parsed value.</span>
|
252
|
+
<span class="ruby-ivar">@ionian_listeners</span> = []
|
192
253
|
|
193
|
-
<span class="ruby-ivar">@
|
194
|
-
<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-value">23</span>
|
195
|
-
<span class="ruby-ivar">@bind_port</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:bind_port</span>, <span class="ruby-ivar">@port</span>
|
254
|
+
<span class="ruby-ivar">@expression</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:expression</span>, <span class="ruby-keyword">nil</span>
|
196
255
|
|
197
|
-
<span class="ruby-
|
198
|
-
|
199
|
-
|
200
|
-
|
256
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_socket</span>
|
257
|
+
<span class="ruby-comment"># Convert existing socket.</span>
|
258
|
+
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">extend</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">IO</span>
|
259
|
+
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">extend</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>
|
260
|
+
|
261
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_socket</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">UNIXSocket</span>
|
262
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">existing_socket</span>.<span class="ruby-identifier">path</span>
|
263
|
+
<span class="ruby-ivar">@port</span> = <span class="ruby-keyword">nil</span>
|
264
|
+
<span class="ruby-keyword">else</span>
|
265
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">existing_socket</span>.<span class="ruby-identifier">remote_address</span>.<span class="ruby-identifier">ip_address</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_socket</span>
|
266
|
+
<span class="ruby-ivar">@port</span> = <span class="ruby-identifier">existing_socket</span>.<span class="ruby-identifier">remote_address</span>.<span class="ruby-identifier">ip_port</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_socket</span>
|
267
|
+
<span class="ruby-keyword">end</span>
|
201
268
|
|
202
|
-
|
203
|
-
|
204
|
-
|
269
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">TCPSocket</span>
|
270
|
+
<span class="ruby-ivar">@protocol</span> = <span class="ruby-value">:tcp</span>
|
271
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">UDPSocket</span>
|
272
|
+
<span class="ruby-ivar">@protocol</span> = <span class="ruby-value">:udp</span>
|
273
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">UNIXSocket</span>
|
274
|
+
<span class="ruby-ivar">@protocol</span> = <span class="ruby-value">:unix</span>
|
275
|
+
<span class="ruby-keyword">end</span>
|
276
|
+
|
277
|
+
<span class="ruby-ivar">@persistent</span> = <span class="ruby-keyword">true</span> <span class="ruby-comment"># Existing sockets are always persistent.</span>
|
278
|
+
|
279
|
+
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">expression</span> = <span class="ruby-ivar">@expression</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@expression</span>
|
280
|
+
|
281
|
+
<span class="ruby-identifier">initialize_socket_methods</span>
|
282
|
+
<span class="ruby-keyword">else</span>
|
283
|
+
<span class="ruby-comment"># Initialize new socket.</span>
|
284
|
+
|
285
|
+
<span class="ruby-comment"># TODO: Should be able to parse the port out of host.</span>
|
286
|
+
<span class="ruby-comment"># :port should override this parsed value.</span>
|
287
|
+
|
288
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:host</span>
|
289
|
+
<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-value">23</span>
|
290
|
+
<span class="ruby-ivar">@bind_port</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:bind_port</span>, <span class="ruby-ivar">@port</span>
|
205
291
|
|
206
|
-
|
207
|
-
|
208
|
-
|
292
|
+
<span class="ruby-comment"># Automatically select UDP for the multicast range. Otherwise default to TCP.</span>
|
293
|
+
<span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:tcp</span>
|
294
|
+
<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">@host</span>
|
295
|
+
<span class="ruby-identifier">default_protocol</span> = <span class="ruby-value">:unix</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@host</span>.<span class="ruby-identifier">start_with?</span> <span class="ruby-string">'/'</span>
|
296
|
+
|
297
|
+
<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>
|
298
|
+
<span class="ruby-ivar">@persistent</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:persistent</span>, <span class="ruby-keyword">true</span>
|
299
|
+
|
300
|
+
<span class="ruby-ivar">@reuse_addr</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:reuse_addr</span>, <span class="ruby-keyword">false</span>
|
301
|
+
<span class="ruby-ivar">@no_delay</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:no_delay</span>, <span class="ruby-keyword">false</span>
|
302
|
+
<span class="ruby-ivar">@cork</span> = <span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:cork</span>, <span class="ruby-keyword">false</span>
|
209
303
|
|
210
|
-
|
304
|
+
|
305
|
+
<span class="ruby-identifier">create_socket</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@persistent</span>
|
306
|
+
<span class="ruby-keyword">end</span>
|
211
307
|
<span class="ruby-keyword">end</span></pre>
|
212
308
|
</div>
|
213
309
|
|
@@ -274,7 +370,7 @@ expression: Overrides the #read_match regular expression for received data.</pre
|
|
274
370
|
|
275
371
|
|
276
372
|
<div class="method-source-code" id="closed-3F-source">
|
277
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
373
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 148</span>
|
278
374
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">closed?</span>
|
279
375
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@socket</span>
|
280
376
|
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">closed?</span>
|
@@ -310,7 +406,7 @@ href="Extension/IO.html#method-i-read_match">Ionian::Extension::IO#read_match</a
|
|
310
406
|
|
311
407
|
|
312
408
|
<div class="method-source-code" id="cmd-source">
|
313
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
409
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 100</span>
|
314
410
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">cmd</span>(<span class="ruby-identifier">string</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
315
411
|
<span class="ruby-identifier">create_socket</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@persistent</span>
|
316
412
|
|
@@ -357,7 +453,7 @@ non-persistent sockets.</p>
|
|
357
453
|
|
358
454
|
|
359
455
|
<div class="method-source-code" id="flush-source">
|
360
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
456
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 155</span>
|
361
457
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">flush</span>
|
362
458
|
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">flush</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@persistent</span>
|
363
459
|
<span class="ruby-keyword">end</span></pre>
|
@@ -393,7 +489,7 @@ non-persistent sockets.</p>
|
|
393
489
|
|
394
490
|
|
395
491
|
<div class="method-source-code" id="has_data-3F-source">
|
396
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
492
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 142</span>
|
397
493
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">has_data?</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>)
|
398
494
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@socket</span>
|
399
495
|
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">has_data?</span> <span class="ruby-identifier">kwargs</span>
|
@@ -408,6 +504,34 @@ non-persistent sockets.</p>
|
|
408
504
|
</div>
|
409
505
|
|
410
506
|
|
507
|
+
<div id="method-i-on_match" class="method-detail method-alias">
|
508
|
+
|
509
|
+
<div class="method-heading">
|
510
|
+
<span class="method-name">on_match</span><span
|
511
|
+
class="method-args">(&block)</span>
|
512
|
+
|
513
|
+
</div>
|
514
|
+
|
515
|
+
|
516
|
+
<div class="method-description">
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
</div>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
<div class="aliases">
|
529
|
+
Alias for: <a href="Socket.html#method-i-register_observer">register_observer</a>
|
530
|
+
</div>
|
531
|
+
|
532
|
+
</div>
|
533
|
+
|
534
|
+
|
411
535
|
<div id="method-i-persistent-3F" class="method-detail ">
|
412
536
|
|
413
537
|
<div class="method-heading">
|
@@ -427,7 +551,7 @@ non-persistent sockets.</p>
|
|
427
551
|
|
428
552
|
|
429
553
|
<div class="method-source-code" id="persistent-3F-source">
|
430
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
554
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 92</span>
|
431
555
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">persistent?</span>
|
432
556
|
<span class="ruby-ivar">@persistent</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@persistent</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
|
433
557
|
<span class="ruby-keyword">end</span></pre>
|
@@ -441,11 +565,11 @@ non-persistent sockets.</p>
|
|
441
565
|
</div>
|
442
566
|
|
443
567
|
|
444
|
-
<div id="method-i-
|
568
|
+
<div id="method-i-puts" class="method-detail ">
|
445
569
|
|
446
570
|
<div class="method-heading">
|
447
|
-
<span class="method-name">
|
448
|
-
class="method-args">()</span>
|
571
|
+
<span class="method-name">puts</span><span
|
572
|
+
class="method-args">(*string)</span>
|
449
573
|
|
450
574
|
<span class="method-click-advice">click to toggle source</span>
|
451
575
|
|
@@ -454,16 +578,16 @@ non-persistent sockets.</p>
|
|
454
578
|
|
455
579
|
<div class="method-description">
|
456
580
|
|
457
|
-
<p>
|
458
|
-
|
581
|
+
<p>Writes the given string(s) to the socket and appends a newline character to
|
582
|
+
any string not already ending with one.</p>
|
459
583
|
|
460
584
|
|
461
585
|
|
462
586
|
|
463
|
-
<div class="method-source-code" id="
|
464
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
465
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
466
|
-
<span class="ruby-
|
587
|
+
<div class="method-source-code" id="puts-source">
|
588
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 161</span>
|
589
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">puts</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">string</span>)
|
590
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">chomp</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"\n"</span>
|
467
591
|
<span class="ruby-keyword">end</span></pre>
|
468
592
|
</div>
|
469
593
|
|
@@ -475,11 +599,11 @@ non-persistent sockets.</p>
|
|
475
599
|
</div>
|
476
600
|
|
477
601
|
|
478
|
-
<div id="method-i-
|
602
|
+
<div id="method-i-register_observer" class="method-detail ">
|
479
603
|
|
480
604
|
<div class="method-heading">
|
481
|
-
<span class="method-name">
|
482
|
-
class="method-args">(
|
605
|
+
<span class="method-name">register_observer</span><span
|
606
|
+
class="method-args">(&block)</span>
|
483
607
|
|
484
608
|
<span class="method-click-advice">click to toggle source</span>
|
485
609
|
|
@@ -488,16 +612,58 @@ non-persistent sockets.</p>
|
|
488
612
|
|
489
613
|
<div class="method-description">
|
490
614
|
|
491
|
-
<p>
|
492
|
-
|
615
|
+
<p>Register a block to be called when run_match receives matched data. Method
|
616
|
+
callbacks can be registered with &object.method(:method). Returns a
|
617
|
+
reference to the given block. block = ionian_socket.register_observer {…}</p>
|
493
618
|
|
494
619
|
|
495
620
|
|
496
621
|
|
497
|
-
<div class="method-source-code" id="
|
498
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
499
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
500
|
-
<span class="ruby-
|
622
|
+
<div class="method-source-code" id="register_observer-source">
|
623
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 121</span>
|
624
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">register_observer</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>
|
625
|
+
<span class="ruby-ivar">@ionian_listeners</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@ionian_listeners</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">block</span>
|
626
|
+
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">register_observer</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span>
|
627
|
+
<span class="ruby-identifier">block</span>
|
628
|
+
<span class="ruby-keyword">end</span></pre>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
</div>
|
632
|
+
|
633
|
+
|
634
|
+
<div class="aliases">
|
635
|
+
Also aliased as: <a href="Socket.html#method-i-on_match">on_match</a>
|
636
|
+
</div>
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
</div>
|
641
|
+
|
642
|
+
|
643
|
+
<div id="method-i-unregister_observer" class="method-detail ">
|
644
|
+
|
645
|
+
<div class="method-heading">
|
646
|
+
<span class="method-name">unregister_observer</span><span
|
647
|
+
class="method-args">(&block)</span>
|
648
|
+
|
649
|
+
<span class="method-click-advice">click to toggle source</span>
|
650
|
+
|
651
|
+
</div>
|
652
|
+
|
653
|
+
|
654
|
+
<div class="method-description">
|
655
|
+
|
656
|
+
<p>Unregister a block from being called when matched data is received.</p>
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
<div class="method-source-code" id="unregister_observer-source">
|
662
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 130</span>
|
663
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unregister_observer</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
664
|
+
<span class="ruby-ivar">@ionian_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">block</span>}
|
665
|
+
<span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">unregister_observer</span> <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@socket</span>
|
666
|
+
<span class="ruby-identifier">block</span>
|
501
667
|
<span class="ruby-keyword">end</span></pre>
|
502
668
|
</div>
|
503
669
|
|
@@ -528,7 +694,7 @@ any string not already ending with one.</p>
|
|
528
694
|
|
529
695
|
|
530
696
|
<div class="method-source-code" id="write-source">
|
531
|
-
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line
|
697
|
+
<pre><span class="ruby-comment"># File lib/ionian/socket.rb, line 167</span>
|
532
698
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">string</span>)
|
533
699
|
<span class="ruby-identifier">create_socket</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@persistent</span>
|
534
700
|
|
@@ -572,7 +738,7 @@ any string not already ending with one.</p>
|
|
572
738
|
|
573
739
|
<footer id="validator-badges" role="contentinfo">
|
574
740
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
575
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
741
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
576
742
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
577
743
|
</footer>
|
578
744
|
|
data/doc/Ionian.html
CHANGED
@@ -24,16 +24,16 @@
|
|
24
24
|
<body id="top" role="document" class="module">
|
25
25
|
<nav role="navigation">
|
26
26
|
<div id="project-navigation">
|
27
|
-
<div id="home-section" role="
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
28
|
<h2>
|
29
29
|
<a href="./index.html" rel="home">Home</a>
|
30
30
|
</h2>
|
31
31
|
|
32
|
-
<
|
32
|
+
<div id="table-of-contents-navigation">
|
33
33
|
<a href="./table_of_contents.html#pages">Pages</a>
|
34
34
|
<a href="./table_of_contents.html#classes">Classes</a>
|
35
35
|
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
-
</
|
36
|
+
</div>
|
37
37
|
</div>
|
38
38
|
|
39
39
|
<div id="search-section" role="search" class="project-section initially-hidden">
|
@@ -41,14 +41,13 @@
|
|
41
41
|
<div id="search-field-wrapper">
|
42
42
|
<input id="search-field" role="combobox" aria-label="Search"
|
43
43
|
aria-autocomplete="list" aria-controls="search-results"
|
44
|
-
type="text" name="search" placeholder="Search"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
46
46
|
</div>
|
47
47
|
|
48
48
|
<ul id="search-results" aria-label="Search Results"
|
49
49
|
aria-busy="false" aria-expanded="false"
|
50
|
-
aria-atomic="false"
|
51
|
-
aria-relevant="all" class="initially-hidden"></ul>
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
52
51
|
</form>
|
53
52
|
</div>
|
54
53
|
|
@@ -97,7 +96,7 @@ Features regular expression matching and notification of received data.</p>
|
|
97
96
|
|
98
97
|
<footer id="validator-badges" role="contentinfo">
|
99
98
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
100
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
99
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
101
100
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
102
101
|
</footer>
|
103
102
|
|
data/doc/created.rid
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
lib/ionian.rb
|
3
|
-
lib/ionian/extension/io.rb
|
1
|
+
Wed, 22 Jan 2014 18:32:41 -0800
|
2
|
+
lib/ionian.rb Sun, 19 Jan 2014 22:25:27 -0800
|
3
|
+
lib/ionian/extension/io.rb Thu, 16 Jan 2014 19:10:20 -0800
|
4
4
|
lib/ionian/extension/socket.rb Sat, 07 Dec 2013 14:02:46 -0800
|
5
|
-
lib/ionian/
|
5
|
+
lib/ionian/server.rb Wed, 22 Jan 2014 18:31:59 -0800
|
6
|
+
lib/ionian/socket.rb Wed, 22 Jan 2014 18:14:29 -0800
|
data/doc/index.html
CHANGED
@@ -24,16 +24,16 @@
|
|
24
24
|
<body id="top" role="document" class="file">
|
25
25
|
<nav role="navigation">
|
26
26
|
<div id="project-navigation">
|
27
|
-
<div id="home-section" role="
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
28
|
<h2>
|
29
29
|
<a href="./index.html" rel="home">Home</a>
|
30
30
|
</h2>
|
31
31
|
|
32
|
-
<
|
32
|
+
<div id="table-of-contents-navigation">
|
33
33
|
<a href="./table_of_contents.html#pages">Pages</a>
|
34
34
|
<a href="./table_of_contents.html#classes">Classes</a>
|
35
35
|
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
-
</
|
36
|
+
</div>
|
37
37
|
</div>
|
38
38
|
|
39
39
|
|
@@ -42,14 +42,13 @@
|
|
42
42
|
<div id="search-field-wrapper">
|
43
43
|
<input id="search-field" role="combobox" aria-label="Search"
|
44
44
|
aria-autocomplete="list" aria-controls="search-results"
|
45
|
-
type="text" name="search" placeholder="Search"
|
45
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
46
46
|
title="Type to search, Up and Down to navigate, Enter to load">
|
47
47
|
</div>
|
48
48
|
|
49
49
|
<ul id="search-results" aria-label="Search Results"
|
50
50
|
aria-busy="false" aria-expanded="false"
|
51
|
-
aria-atomic="false"
|
52
|
-
aria-relevant="all" class="initially-hidden"></ul>
|
51
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
52
|
</form>
|
54
53
|
</div>
|
55
54
|
|
@@ -70,6 +69,8 @@
|
|
70
69
|
|
71
70
|
<li><a href="./Ionian/Extension/Socket.html">Ionian::Extension::Socket</a>
|
72
71
|
|
72
|
+
<li><a href="./Ionian/Server.html">Ionian::Server</a>
|
73
|
+
|
73
74
|
<li><a href="./Ionian/Socket.html">Ionian::Socket</a>
|
74
75
|
|
75
76
|
</ul>
|
@@ -86,7 +87,7 @@
|
|
86
87
|
|
87
88
|
<footer id="validator-badges" role="contentinfo">
|
88
89
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
89
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
90
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
90
91
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
91
92
|
</footer>
|
92
93
|
|
data/doc/js/search.js
CHANGED
@@ -14,7 +14,12 @@ Search.prototype = $.extend({}, Navigation, new function() {
|
|
14
14
|
|
15
15
|
this.init = function() {
|
16
16
|
var _this = this;
|
17
|
-
var observer = function() {
|
17
|
+
var observer = function(e) {
|
18
|
+
switch(e.originalEvent.keyCode) {
|
19
|
+
case 38: // Event.KEY_UP
|
20
|
+
case 40: // Event.KEY_DOWN
|
21
|
+
return;
|
22
|
+
}
|
18
23
|
_this.search(_this.$input[0].value);
|
19
24
|
};
|
20
25
|
this.$input.keyup(observer);
|
@@ -82,6 +87,8 @@ Search.prototype = $.extend({}, Navigation, new function() {
|
|
82
87
|
this.$input.attr('aria-activedescendant', $next.attr('id'));
|
83
88
|
this.scrollIntoView($next[0], this.$view[0]);
|
84
89
|
this.$current = $next;
|
90
|
+
this.$input.val($next[0].firstChild.firstChild.text);
|
91
|
+
this.$input.select();
|
85
92
|
}
|
86
93
|
return true;
|
87
94
|
}
|