ionian 0.6.10 → 0.6.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61efbd85a326b684d668f54e4496bfd23c451c84
4
- data.tar.gz: af8b92a6b8a56fe02df3a7ae614fb2c5382905a3
3
+ metadata.gz: e26c23c377fd8040799e0402c9b158b349b1d214
4
+ data.tar.gz: e14513b53b83104a714628e5c90858bc3a91107e
5
5
  SHA512:
6
- metadata.gz: a80886edea84560e14d11b095324c67b189b0aa33919f7a830d736ed0747c4bb58e587850afddcbded09d217aa234659c6347ce458ec2a59f3c68678e34a0299
7
- data.tar.gz: 410498a2d2d6aa76183ecbe9b05101420d468c0b922dfd63cbb9042be2d4917c9bc6cfe8de5fc832d3515c1f3bd3f6abd692c3ed038b009b6b862688741906a1
6
+ metadata.gz: bc4340836f0686884445e7c27f213952fc3791b7d8aec7f508818fc3c8a02e786a1f0245ede4380b6b152848d3a28373467970718f0b15775116fce160588a06
7
+ data.tar.gz: c9b71ce2de0646eddd164342ee6f84d156d603b58c0e882b79088e6fadf77f00126b716577ff75f80ba5574680f6dff3d8551a5723e6dd4c20e5884086b28908
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="r1 last">Defined in:</dt>
82
82
  <dd class="r1 last">lib/ionian.rb<span class="defines">,<br />
83
- lib/ionian/server.rb,<br /> lib/ionian/socket.rb,<br /> lib/ionian/extension/io.rb,<br /> lib/ionian/extension/socket.rb</span>
83
+ lib/ionian/socket.rb,<br /> lib/ionian/server.rb,<br /> lib/ionian/extension/io.rb,<br /> lib/ionian/extension/socket.rb</span>
84
84
  </dd>
85
85
 
86
86
  </dl>
@@ -123,9 +123,9 @@ Features regular expression matching and notification of received data.</p>
123
123
  </div>
124
124
 
125
125
  <div id="footer">
126
- Generated on Fri Oct 31 17:19:45 2014 by
126
+ Generated on Fri Jan 23 20:34:47 2015 by
127
127
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
128
- 0.8.7.6 (ruby-2.1.4).
128
+ 0.8.7.6 (ruby-2.1.5).
129
129
  </div>
130
130
 
131
131
  </body>
@@ -119,9 +119,9 @@
119
119
  </div>
120
120
 
121
121
  <div id="footer">
122
- Generated on Fri Oct 31 17:19:45 2014 by
122
+ Generated on Fri Jan 23 20:34:47 2015 by
123
123
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
124
- 0.8.7.6 (ruby-2.1.4).
124
+ 0.8.7.6 (ruby-2.1.5).
125
125
  </div>
126
126
 
127
127
  </body>
@@ -1302,9 +1302,9 @@ socket|). Passes kwargs to <span class='object_link'><a href="#read_match-instan
1302
1302
  </div>
1303
1303
 
1304
1304
  <div id="footer">
1305
- Generated on Fri Oct 31 17:19:45 2014 by
1305
+ Generated on Fri Jan 23 20:34:48 2015 by
1306
1306
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1307
- 0.8.7.6 (ruby-2.1.4).
1307
+ 0.8.7.6 (ruby-2.1.5).
1308
1308
  </div>
1309
1309
 
1310
1310
  </body>
@@ -2530,9 +2530,9 @@ true.</p>
2530
2530
  </div>
2531
2531
 
2532
2532
  <div id="footer">
2533
- Generated on Fri Oct 31 17:19:45 2014 by
2533
+ Generated on Fri Jan 23 20:34:48 2015 by
2534
2534
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2535
- 0.8.7.6 (ruby-2.1.4).
2535
+ 0.8.7.6 (ruby-2.1.5).
2536
2536
  </div>
2537
2537
 
2538
2538
  </body>
@@ -930,9 +930,9 @@ connected client is passed to the block as an Ionain::Client.</p>
930
930
  </div>
931
931
 
932
932
  <div id="footer">
933
- Generated on Fri Oct 31 17:19:45 2014 by
933
+ Generated on Fri Jan 23 20:34:48 2015 by
934
934
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
935
- 0.8.7.6 (ruby-2.1.4).
935
+ 0.8.7.6 (ruby-2.1.5).
936
936
  </div>
937
937
 
938
938
  </body>
@@ -664,6 +664,23 @@ in the multicast range, or if the broadcast flag is set.</p>
664
664
 
665
665
  </li>
666
666
 
667
+ <li>
668
+ <span class="name">:connect_timeout</span>
669
+ <span class="type">(<tt>Fixnum</tt>)</span>
670
+ <span class="default">
671
+
672
+ &mdash; default:
673
+ <tt>nil</tt>
674
+
675
+ </span>
676
+
677
+ &mdash; <div class='inline'>
678
+ <p>Number of seconds to wait when connecting before timing out. Raises
679
+ Errno::EHOSTUNREACH.</p>
680
+ </div>
681
+
682
+ </li>
683
+
667
684
  <li>
668
685
  <span class="name">:persistent</span>
669
686
  <span class="type">(<tt>Boolean</tt>)</span>
@@ -824,9 +841,6 @@ the block.</p>
824
841
  <pre class="lines">
825
842
 
826
843
 
827
- 73
828
- 74
829
- 75
830
844
  76
831
845
  77
832
846
  78
@@ -903,10 +917,14 @@ the block.</p>
903
917
  149
904
918
  150
905
919
  151
906
- 152</pre>
920
+ 152
921
+ 153
922
+ 154
923
+ 155
924
+ 156</pre>
907
925
  </td>
908
926
  <td>
909
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 73</span>
927
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 76</span>
910
928
 
911
929
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_existing_socket'>existing_socket</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</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>
912
930
  <span class='ivar'>@socket</span> <span class='op'>=</span> <span class='id identifier rubyid_existing_socket'>existing_socket</span>
@@ -946,11 +964,12 @@ the block.</p>
946
964
  <span class='comment'># Initialize new socket.
947
965
  </span>
948
966
  <span class='comment'># Parse host out of &quot;host:port&quot; if specified.
949
- </span> <span class='id identifier rubyid_host_port_ary'>host_port_ary</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='lparen'>(</span><span class='symbol'>:host</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span>
967
+ </span> <span class='id identifier rubyid_host_port_array'>host_port_array</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='lparen'>(</span><span class='symbol'>:host</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span>
950
968
 
951
- <span class='ivar'>@host</span> <span class='op'>=</span> <span class='id identifier rubyid_host_port_ary'>host_port_ary</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
952
- <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='id identifier rubyid_host_port_ary'>host_port_ary</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>||</span> <span class='int'>23</span>
969
+ <span class='ivar'>@host</span> <span class='op'>=</span> <span class='id identifier rubyid_host_port_array'>host_port_array</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
970
+ <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='lparen'>(</span><span class='id identifier rubyid_host_port_array'>host_port_array</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>23</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
953
971
  <span class='ivar'>@bind_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'>:bind_port</span><span class='comma'>,</span> <span class='ivar'>@port</span>
972
+ <span class='ivar'>@connect_timeout</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'>:connect_timeout</span><span class='comma'>,</span> <span class='kw'>nil</span>
954
973
 
955
974
  <span class='ivar'>@broadcast</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'>:broadcast</span><span class='comma'>,</span> <span class='kw'>false</span>
956
975
 
@@ -1221,13 +1240,13 @@ the block.</p>
1221
1240
  <pre class="lines">
1222
1241
 
1223
1242
 
1224
- 222
1225
- 223
1226
- 224
1227
- 225</pre>
1243
+ 226
1244
+ 227
1245
+ 228
1246
+ 229</pre>
1228
1247
  </td>
1229
1248
  <td>
1230
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 222</span>
1249
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 226</span>
1231
1250
 
1232
1251
  <span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
1233
1252
  <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='ivar'>@socket</span>
@@ -1329,20 +1348,20 @@ the block.</p>
1329
1348
  <pre class="lines">
1330
1349
 
1331
1350
 
1332
- 179
1333
- 180
1334
- 181
1335
- 182
1336
1351
  183
1337
1352
  184
1338
1353
  185
1339
1354
  186
1340
1355
  187
1341
1356
  188
1342
- 189</pre>
1357
+ 189
1358
+ 190
1359
+ 191
1360
+ 192
1361
+ 193</pre>
1343
1362
  </td>
1344
1363
  <td>
1345
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 179</span>
1364
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 183</span>
1346
1365
 
1347
1366
  <span class='kw'>def</span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</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>
1348
1367
  <span class='id identifier rubyid_create_socket'>create_socket</span> <span class='kw'>unless</span> <span class='ivar'>@persistent</span>
@@ -1386,12 +1405,12 @@ the block.</p>
1386
1405
  <pre class="lines">
1387
1406
 
1388
1407
 
1389
- 155
1390
- 156
1391
- 157</pre>
1408
+ 159
1409
+ 160
1410
+ 161</pre>
1392
1411
  </td>
1393
1412
  <td>
1394
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 155</span>
1413
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 159</span>
1395
1414
 
1396
1415
  <span class='kw'>def</span> <span class='id identifier rubyid_expression'>expression</span>
1397
1416
  <span class='ivar'>@expression</span> <span class='op'>||</span> <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_expression'>expression</span>
@@ -1427,13 +1446,13 @@ the block.</p>
1427
1446
  <pre class="lines">
1428
1447
 
1429
1448
 
1430
- 160
1431
- 161
1432
- 162
1433
- 163</pre>
1449
+ 164
1450
+ 165
1451
+ 166
1452
+ 167</pre>
1434
1453
  </td>
1435
1454
  <td>
1436
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 160</span>
1455
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 164</span>
1437
1456
 
1438
1457
  <span class='kw'>def</span> <span class='id identifier rubyid_expression='>expression=</span> <span class='id identifier rubyid_exp'>exp</span>
1439
1458
  <span class='ivar'>@expression</span> <span class='op'>=</span> <span class='id identifier rubyid_exp'>exp</span>
@@ -1471,12 +1490,12 @@ non-persistent sockets.</p>
1471
1490
  <pre class="lines">
1472
1491
 
1473
1492
 
1474
- 229
1475
- 230
1476
- 231</pre>
1493
+ 233
1494
+ 234
1495
+ 235</pre>
1477
1496
  </td>
1478
1497
  <td>
1479
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 229</span>
1498
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 233</span>
1480
1499
 
1481
1500
  <span class='kw'>def</span> <span class='id identifier rubyid_flush'>flush</span>
1482
1501
  <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span> <span class='kw'>if</span> <span class='ivar'>@persistent</span>
@@ -1528,13 +1547,13 @@ non-persistent sockets.</p>
1528
1547
  <pre class="lines">
1529
1548
 
1530
1549
 
1531
- 216
1532
- 217
1533
- 218
1534
- 219</pre>
1550
+ 220
1551
+ 221
1552
+ 222
1553
+ 223</pre>
1535
1554
  </td>
1536
1555
  <td>
1537
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 216</span>
1556
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 220</span>
1538
1557
 
1539
1558
  <span class='kw'>def</span> <span class='id identifier rubyid_has_data?'>has_data?</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span>
1540
1559
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='ivar'>@socket</span>
@@ -1584,12 +1603,12 @@ non-persistent sockets.</p>
1584
1603
  <pre class="lines">
1585
1604
 
1586
1605
 
1587
- 166
1588
- 167
1589
- 168</pre>
1606
+ 170
1607
+ 171
1608
+ 172</pre>
1590
1609
  </td>
1591
1610
  <td>
1592
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 166</span>
1611
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 170</span>
1593
1612
 
1594
1613
  <span class='kw'>def</span> <span class='id identifier rubyid_persistent?'>persistent?</span>
1595
1614
  <span class='ivar'>@persistent</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='op'>||</span> <span class='ivar'>@persistent</span> <span class='op'>==</span> <span class='kw'>nil</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='kw'>true</span>
@@ -1626,12 +1645,12 @@ any string not already ending with one.</p>
1626
1645
  <pre class="lines">
1627
1646
 
1628
1647
 
1629
- 235
1630
- 236
1631
- 237</pre>
1648
+ 239
1649
+ 240
1650
+ 241</pre>
1632
1651
  </td>
1633
1652
  <td>
1634
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 235</span>
1653
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 239</span>
1635
1654
 
1636
1655
  <span class='kw'>def</span> <span class='id identifier rubyid_puts'>puts</span> <span class='op'>*</span><span class='id identifier rubyid_string'>string</span>
1637
1656
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_chomp'>chomp</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
@@ -1673,14 +1692,14 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
1673
1692
  <pre class="lines">
1674
1693
 
1675
1694
 
1676
- 195
1677
- 196
1678
- 197
1679
- 198
1680
- 199</pre>
1695
+ 199
1696
+ 200
1697
+ 201
1698
+ 202
1699
+ 203</pre>
1681
1700
  </td>
1682
1701
  <td>
1683
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 195</span>
1702
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 199</span>
1684
1703
 
1685
1704
  <span class='kw'>def</span> <span class='id identifier rubyid_register_observer'>register_observer</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
1686
1705
  <span class='ivar'>@ionian_listeners</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_block'>block</span> <span class='kw'>unless</span> <span class='ivar'>@ionian_listeners</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_block'>block</span>
@@ -1718,14 +1737,14 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
1718
1737
  <pre class="lines">
1719
1738
 
1720
1739
 
1721
- 204
1722
- 205
1723
- 206
1724
- 207
1725
- 208</pre>
1740
+ 208
1741
+ 209
1742
+ 210
1743
+ 211
1744
+ 212</pre>
1726
1745
  </td>
1727
1746
  <td>
1728
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 204</span>
1747
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 208</span>
1729
1748
 
1730
1749
  <span class='kw'>def</span> <span class='id identifier rubyid_unregister_observer'>unregister_observer</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
1731
1750
  <span class='ivar'>@ionian_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_block'>block</span> <span class='rbrace'>}</span>
@@ -1767,10 +1786,6 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
1767
1786
  <pre class="lines">
1768
1787
 
1769
1788
 
1770
- 241
1771
- 242
1772
- 243
1773
- 244
1774
1789
  245
1775
1790
  246
1776
1791
  247
@@ -1793,10 +1808,14 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
1793
1808
  264
1794
1809
  265
1795
1810
  266
1796
- 267</pre>
1811
+ 267
1812
+ 268
1813
+ 269
1814
+ 270
1815
+ 271</pre>
1797
1816
  </td>
1798
1817
  <td>
1799
- <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 241</span>
1818
+ <pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 245</span>
1800
1819
 
1801
1820
  <span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_string'>string</span>
1802
1821
  <span class='id identifier rubyid_create_socket'>create_socket</span> <span class='kw'>unless</span> <span class='ivar'>@persistent</span>
@@ -1835,9 +1854,9 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
1835
1854
  </div>
1836
1855
 
1837
1856
  <div id="footer">
1838
- Generated on Fri Oct 31 17:19:46 2014 by
1857
+ Generated on Fri Jan 23 20:34:48 2015 by
1839
1858
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1840
- 0.8.7.6 (ruby-2.1.4).
1859
+ 0.8.7.6 (ruby-2.1.5).
1841
1860
  </div>
1842
1861
 
1843
1862
  </body>
@@ -155,9 +155,9 @@
155
155
  </div>
156
156
 
157
157
  <div id="footer">
158
- Generated on Fri Oct 31 17:19:44 2014 by
158
+ Generated on Fri Jan 23 20:34:47 2015 by
159
159
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
160
- 0.8.7.6 (ruby-2.1.4).
160
+ 0.8.7.6 (ruby-2.1.5).
161
161
  </div>
162
162
 
163
163
  </body>
@@ -79,7 +79,8 @@ data.</p>
79
79
 
80
80
  <h2 id="label-Installation">Installation</h2>
81
81
 
82
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_ionian'>ionian</span></code></pre>
82
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_ionian'>ionian</span>
83
+ </code></pre>
83
84
 
84
85
  <h2 id="label-Code+Examples">Code Examples</h2>
85
86
 
@@ -138,9 +139,9 @@ data.</p>
138
139
  </div></div>
139
140
 
140
141
  <div id="footer">
141
- Generated on Fri Oct 31 17:19:45 2014 by
142
+ Generated on Fri Jan 23 20:34:47 2015 by
142
143
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
143
- 0.8.7.6 (ruby-2.1.4).
144
+ 0.8.7.6 (ruby-2.1.5).
144
145
  </div>
145
146
 
146
147
  </body>
@@ -61,12 +61,12 @@
61
61
 
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
- <div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2013-2014 Alex McLain<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.
64
+ <div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2013-2015 Alex McLain<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.
65
65
 
66
66
  <div id="footer">
67
- Generated on Fri Oct 31 17:19:45 2014 by
67
+ Generated on Fri Jan 23 20:34:47 2015 by
68
68
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
69
- 0.8.7.6 (ruby-2.1.4).
69
+ 0.8.7.6 (ruby-2.1.5).
70
70
  </div>
71
71
 
72
72
  </body>
@@ -79,7 +79,8 @@ data.</p>
79
79
 
80
80
  <h2 id="label-Installation">Installation</h2>
81
81
 
82
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_ionian'>ionian</span></code></pre>
82
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_ionian'>ionian</span>
83
+ </code></pre>
83
84
 
84
85
  <h2 id="label-Code+Examples">Code Examples</h2>
85
86
 
@@ -138,9 +139,9 @@ data.</p>
138
139
  </div></div>
139
140
 
140
141
  <div id="footer">
141
- Generated on Fri Oct 31 17:19:44 2014 by
142
+ Generated on Fri Jan 23 20:34:47 2015 by
142
143
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
143
- 0.8.7.6 (ruby-2.1.4).
144
+ 0.8.7.6 (ruby-2.1.5).
144
145
  </div>
145
146
 
146
147
  </body>
@@ -106,14 +106,14 @@
106
106
 
107
107
 
108
108
  <li class="r2 ">
109
- <span class='object_link'><a href="Ionian/Socket.html#expression-instance_method" title="Ionian::Socket#expression (method)">#expression</a></span>
110
- <small>Ionian::Socket</small>
109
+ <span class='object_link'><a href="Ionian/Extension/IO.html#expression-instance_method" title="Ionian::Extension::IO#expression (method)">#expression</a></span>
110
+ <small>Ionian::Extension::IO</small>
111
111
  </li>
112
112
 
113
113
 
114
114
  <li class="r1 ">
115
- <span class='object_link'><a href="Ionian/Extension/IO.html#expression-instance_method" title="Ionian::Extension::IO#expression (method)">#expression</a></span>
116
- <small>Ionian::Extension::IO</small>
115
+ <span class='object_link'><a href="Ionian/Socket.html#expression-instance_method" title="Ionian::Socket#expression (method)">#expression</a></span>
116
+ <small>Ionian::Socket</small>
117
117
  </li>
118
118
 
119
119
 
@@ -166,14 +166,14 @@
166
166
 
167
167
 
168
168
  <li class="r2 ">
169
- <span class='object_link'><a href="Ionian/Socket.html#initialize-instance_method" title="Ionian::Socket#initialize (method)">#initialize</a></span>
170
- <small>Ionian::Socket</small>
169
+ <span class='object_link'><a href="Ionian/Server.html#initialize-instance_method" title="Ionian::Server#initialize (method)">#initialize</a></span>
170
+ <small>Ionian::Server</small>
171
171
  </li>
172
172
 
173
173
 
174
174
  <li class="r1 ">
175
- <span class='object_link'><a href="Ionian/Server.html#initialize-instance_method" title="Ionian::Server#initialize (method)">#initialize</a></span>
176
- <small>Ionian::Server</small>
175
+ <span class='object_link'><a href="Ionian/Socket.html#initialize-instance_method" title="Ionian::Socket#initialize (method)">#initialize</a></span>
176
+ <small>Ionian::Socket</small>
177
177
  </li>
178
178
 
179
179
 
@@ -316,13 +316,13 @@
316
316
 
317
317
 
318
318
  <li class="r1 ">
319
- <span class='object_link'><a href="Ionian/Extension/Socket.html#multicast-instance_method" title="Ionian::Extension::Socket#multicast (method)">#multicast</a></span>
319
+ <span class='object_link'><a href="Ionian/Extension/Socket.html#multicast-class_method" title="Ionian::Extension::Socket.multicast (method)">multicast</a></span>
320
320
  <small>Ionian::Extension::Socket</small>
321
321
  </li>
322
322
 
323
323
 
324
324
  <li class="r2 ">
325
- <span class='object_link'><a href="Ionian/Extension/Socket.html#multicast-class_method" title="Ionian::Extension::Socket.multicast (method)">multicast</a></span>
325
+ <span class='object_link'><a href="Ionian/Extension/Socket.html#multicast-instance_method" title="Ionian::Extension::Socket#multicast (method)">#multicast</a></span>
326
326
  <small>Ionian::Extension::Socket</small>
327
327
  </li>
328
328
 
@@ -364,14 +364,14 @@
364
364
 
365
365
 
366
366
  <li class="r1 ">
367
- <span class='object_link'><a href="Ionian/Socket.html#protocol-instance_method" title="Ionian::Socket#protocol (method)">#protocol</a></span>
368
- <small>Ionian::Socket</small>
367
+ <span class='object_link'><a href="Ionian/Server.html#protocol-instance_method" title="Ionian::Server#protocol (method)">#protocol</a></span>
368
+ <small>Ionian::Server</small>
369
369
  </li>
370
370
 
371
371
 
372
372
  <li class="r2 ">
373
- <span class='object_link'><a href="Ionian/Server.html#protocol-instance_method" title="Ionian::Server#protocol (method)">#protocol</a></span>
374
- <small>Ionian::Server</small>
373
+ <span class='object_link'><a href="Ionian/Socket.html#protocol-instance_method" title="Ionian::Socket#protocol (method)">#protocol</a></span>
374
+ <small>Ionian::Socket</small>
375
375
  </li>
376
376
 
377
377
 
@@ -460,14 +460,14 @@
460
460
 
461
461
 
462
462
  <li class="r1 ">
463
- <span class='object_link'><a href="Ionian/Socket.html#unregister_observer-instance_method" title="Ionian::Socket#unregister_observer (method)">#unregister_observer</a></span>
464
- <small>Ionian::Socket</small>
463
+ <span class='object_link'><a href="Ionian/Extension/IO.html#unregister_observer-instance_method" title="Ionian::Extension::IO#unregister_observer (method)">#unregister_observer</a></span>
464
+ <small>Ionian::Extension::IO</small>
465
465
  </li>
466
466
 
467
467
 
468
468
  <li class="r2 ">
469
- <span class='object_link'><a href="Ionian/Extension/IO.html#unregister_observer-instance_method" title="Ionian::Extension::IO#unregister_observer (method)">#unregister_observer</a></span>
470
- <small>Ionian::Extension::IO</small>
469
+ <span class='object_link'><a href="Ionian/Socket.html#unregister_observer-instance_method" title="Ionian::Socket#unregister_observer (method)">#unregister_observer</a></span>
470
+ <small>Ionian::Socket</small>
471
471
  </li>
472
472
 
473
473
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Fri Oct 31 17:19:45 2014 by
106
+ Generated on Fri Jan 23 20:34:47 2015 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.6 (ruby-2.1.4).
108
+ 0.8.7.6 (ruby-2.1.5).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -40,6 +40,9 @@ module Ionian
40
40
  # :udp will be automatically selected for addresses in the multicast
41
41
  # range, or if the broadcast flag is set.
42
42
  #
43
+ # @option kwargs [Fixnum] :connect_timeout (nil) Number of seconds to wait
44
+ # when connecting before timing out. Raises Errno::EHOSTUNREACH.
45
+ #
43
46
  # @option kwargs [Boolean] :persistent (true) The socket remains open after
44
47
  # data is sent if this is true. The socket closes after data is sent and
45
48
  # a packet is received if this is false.
@@ -108,11 +111,12 @@ module Ionian
108
111
  # Initialize new socket.
109
112
 
110
113
  # Parse host out of "host:port" if specified.
111
- host_port_ary = kwargs.fetch(:host).to_s.split ':'
114
+ host_port_array = kwargs.fetch(:host).to_s.split ':'
112
115
 
113
- @host = host_port_ary[0]
114
- @port = kwargs.fetch :port, host_port_ary[1].to_i || 23
116
+ @host = host_port_array[0]
117
+ @port = kwargs.fetch :port, (host_port_array[1] || 23).to_i
115
118
  @bind_port = kwargs.fetch :bind_port, @port
119
+ @connect_timeout = kwargs.fetch :connect_timeout, nil
116
120
 
117
121
  @broadcast = kwargs.fetch :broadcast, false
118
122
 
@@ -275,46 +279,52 @@ module Ionian
275
279
  def create_socket
276
280
  @socket.close if @socket and not @socket.closed?
277
281
 
278
- case @protocol
279
- when :tcp
280
- @socket = ::TCPSocket.new @host, @port
281
- @socket.extend Ionian::Extension::Socket
282
-
283
- @socket.no_delay = @no_delay
284
- # Windows complains at SO_CORK, so only set it if it was specified.
285
- @socket.cork = @cork if @cork
286
-
287
- when :udp
288
- @socket = ::UDPSocket.new
289
- @socket.extend Ionian::Extension::Socket
290
-
291
- @socket.reuse_addr = true if
292
- @reuse_addr or
293
- @broadcast or
294
- Ionian::Extension::Socket.multicast? @host
282
+ begin
283
+ Timeout.timeout(@connect_timeout) do
284
+ case @protocol
285
+ when :tcp
286
+ @socket = ::TCPSocket.new @host, @port
287
+ @socket.extend Ionian::Extension::Socket
288
+
289
+ @socket.no_delay = @no_delay
290
+ # Windows complains at SO_CORK, so only set it if it was specified.
291
+ @socket.cork = @cork if @cork
292
+
293
+ when :udp
294
+ @socket = ::UDPSocket.new
295
+ @socket.extend Ionian::Extension::Socket
296
+
297
+ @socket.reuse_addr = true if
298
+ @reuse_addr or
299
+ @broadcast or
300
+ Ionian::Extension::Socket.multicast? @host
301
+
302
+ @socket.broadcast = true if @broadcast
303
+
304
+ @socket.bind ::Socket::INADDR_ANY, @bind_port
305
+ @socket.connect @host, @port
306
+
307
+ @socket.ip_add_membership if Ionian::Extension::Socket.multicast? @host
308
+
309
+ when :unix
310
+ @socket = ::UNIXSocket.new @host
311
+ @socket.extend Ionian::Extension::Socket
312
+
313
+ end
295
314
 
296
- @socket.broadcast = true if @broadcast
297
-
298
- @socket.bind ::Socket::INADDR_ANY, @bind_port
299
- @socket.connect @host, @port
300
-
301
- @socket.ip_add_membership if Ionian::Extension::Socket.multicast? @host
302
-
303
- when :unix
304
- @socket = ::UNIXSocket.new @host
305
- @socket.extend Ionian::Extension::Socket
306
-
315
+ # Windows complains at SO_LINGER, so only set it if it was specified.
316
+ @socket.linger = @linger if @linger
317
+
318
+ @socket.expression = @expression if @expression
319
+
320
+ # Register listeners.
321
+ @ionian_listeners.each { |proc| @socket.on_match &proc }
322
+
323
+ initialize_socket_methods
324
+ end
325
+ rescue Timeout::Error
326
+ raise Errno::EHOSTUNREACH
307
327
  end
308
-
309
- # Windows complains at SO_LINGER, so only set it if it was specified.
310
- @socket.linger = @linger if @linger
311
-
312
- @socket.expression = @expression if @expression
313
-
314
- # Register listeners.
315
- @ionian_listeners.each { |proc| @socket.on_match &proc }
316
-
317
- initialize_socket_methods
318
328
  end
319
329
 
320
330
  # Expose the @socket methods that haven't been defined by this class.
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2014 Alex McLain
3
+ Copyright (c) 2013-2015 Alex McLain
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ionian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.10
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McLain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.2.2
167
+ rubygems_version: 2.4.5
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Regular expression matching and notification for IO streams.