ionian 0.6.5 → 0.6.6
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 +4 -4
- data/README.md +16 -2
- data/doc/Ionian/Extension/IO.html +36 -32
- data/doc/Ionian/Extension/Socket.html +1 -1
- data/doc/Ionian/Extension.html +1 -1
- data/doc/Ionian/Server.html +337 -64
- data/doc/Ionian/Socket.html +47 -47
- data/doc/Ionian.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +16 -3
- data/doc/file.license.html +1 -1
- data/doc/index.html +16 -3
- data/doc/method_list.html +73 -55
- data/doc/top-level-namespace.html +1 -1
- data/lib/ionian/extension/io.rb +4 -1
- data/lib/ionian/server.rb +38 -6
- data/lib/ionian/socket.rb +7 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cb36e7af34abe393cc46d7f30ce072f409a5c9b
|
4
|
+
data.tar.gz: d65cc6850c15fc177751cd29a9594ae47cdd4d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dfb53195818fe11aedad450bafdaefe9c72e34ee2394e5aed5fa78db750a2a417bc88151534da055f1395d70eea8e46d0e7dc4fd3020fa7b86ad622a761fa39
|
7
|
+
data.tar.gz: 287ba033ae14c028c1c58b9ca7ca838341a61181ef078f4c1914f4908abc17b0b519e030a2cb10ce83c934176b0047fb5e2103485da615eb2f4e38636457f2bf
|
data/README.md
CHANGED
@@ -38,8 +38,7 @@ socket.read_match { |match| p match; puts '' }
|
|
38
38
|
# A simple IRC client.
|
39
39
|
|
40
40
|
socket = Ionian::Socket.new \
|
41
|
-
host: 'chat.freenode.net',
|
42
|
-
port: 6667,
|
41
|
+
host: 'chat.freenode.net:6667',
|
43
42
|
# Break up the matches into named captures so it's easier
|
44
43
|
# to sort through the server's responses.
|
45
44
|
expression: /:(?<server>.*?)\s*:(?<msg>.*?)[\r\n]+/
|
@@ -61,3 +60,18 @@ loop do
|
|
61
60
|
end
|
62
61
|
end
|
63
62
|
```
|
63
|
+
|
64
|
+
### Simple Server
|
65
|
+
|
66
|
+
``` ruby
|
67
|
+
host = 'localhost:5000'
|
68
|
+
|
69
|
+
server = Ionian::Server.new interface: host do |client|
|
70
|
+
# Greet the connected client.
|
71
|
+
client.write "Welcome! You are connected to the server.\n"
|
72
|
+
end
|
73
|
+
|
74
|
+
socket = Ionian::Socket.new host: host
|
75
|
+
# Retrieve the greeting message.
|
76
|
+
puts socket.read_all
|
77
|
+
```
|
@@ -751,14 +751,14 @@ automatically.</p>
|
|
751
751
|
<pre class="lines">
|
752
752
|
|
753
753
|
|
754
|
-
154
|
755
|
-
155
|
756
|
-
156
|
757
754
|
157
|
758
|
-
158
|
755
|
+
158
|
756
|
+
159
|
757
|
+
160
|
758
|
+
161</pre>
|
759
759
|
</td>
|
760
760
|
<td>
|
761
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
761
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 157</span>
|
762
762
|
|
763
763
|
<span class='kw'>def</span> <span class='id identifier rubyid_purge'>purge</span>
|
764
764
|
<span class='comment'># Erase IO buffer.
|
@@ -783,7 +783,7 @@ automatically.</p>
|
|
783
783
|
<div class="discussion">
|
784
784
|
|
785
785
|
<p>Read all data in the buffer. An alternative to using #readpartial with a
|
786
|
-
large length.</p>
|
786
|
+
large length. Blocks until data is available.</p>
|
787
787
|
|
788
788
|
|
789
789
|
</div>
|
@@ -797,18 +797,22 @@ large length.</p>
|
|
797
797
|
<pre class="lines">
|
798
798
|
|
799
799
|
|
800
|
-
56
|
801
800
|
57
|
802
801
|
58
|
803
802
|
59
|
804
|
-
60
|
803
|
+
60
|
804
|
+
61
|
805
|
+
62
|
806
|
+
63</pre>
|
805
807
|
</td>
|
806
808
|
<td>
|
807
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
809
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 57</span>
|
808
810
|
|
809
811
|
<span class='kw'>def</span> <span class='id identifier rubyid_read_all'>read_all</span>
|
810
|
-
<span class='
|
811
|
-
<span class='id identifier rubyid_data'>data</span> <span class='op'
|
812
|
+
<span class='comment'># Block until data has arrived.
|
813
|
+
</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_readpartial'>readpartial</span> <span class='int'>0xFFFF</span>
|
814
|
+
<span class='comment'># If there is more data in the buffer, retrieve it nonblocking.
|
815
|
+
</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>+=</span> <span class='id identifier rubyid_readpartial'>readpartial</span> <span class='int'>0xFFFF</span> <span class='kw'>while</span> <span class='id identifier rubyid_has_data?'>has_data?</span>
|
812
816
|
<span class='id identifier rubyid_data'>data</span>
|
813
817
|
<span class='kw'>end</span></pre>
|
814
818
|
</td>
|
@@ -868,9 +872,6 @@ build_methods: Build accessor methods from named capture groups.
|
|
868
872
|
<pre class="lines">
|
869
873
|
|
870
874
|
|
871
|
-
88
|
872
|
-
89
|
873
|
-
90
|
874
875
|
91
|
875
876
|
92
|
876
877
|
93
|
@@ -912,10 +913,13 @@ build_methods: Build accessor methods from named capture groups.
|
|
912
913
|
129
|
913
914
|
130
|
914
915
|
131
|
915
|
-
132
|
916
|
+
132
|
917
|
+
133
|
918
|
+
134
|
919
|
+
135</pre>
|
916
920
|
</td>
|
917
921
|
<td>
|
918
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
922
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 91</span>
|
919
923
|
|
920
924
|
<span class='kw'>def</span> <span class='id identifier rubyid_read_match'>read_match</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
921
925
|
<span class='id identifier rubyid_timeout'>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'>:timeout</span><span class='comma'>,</span> <span class='ivar'>@ionian_timeout</span>
|
@@ -999,13 +1003,13 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
|
|
999
1003
|
<pre class="lines">
|
1000
1004
|
|
1001
1005
|
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
+
167
|
1007
|
+
168
|
1008
|
+
169
|
1009
|
+
170</pre>
|
1006
1010
|
</td>
|
1007
1011
|
<td>
|
1008
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
1012
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 167</span>
|
1009
1013
|
|
1010
1014
|
<span class='kw'>def</span> <span class='id identifier rubyid_register_observer'>register_observer</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
1011
1015
|
<span class='ivar'>@ionian_listeners</span> <span class='op'><<</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>
|
@@ -1044,9 +1048,6 @@ socket|). Passes kwargs to #read_match. This method SHOULD NOT be used if
|
|
1044
1048
|
<pre class="lines">
|
1045
1049
|
|
1046
1050
|
|
1047
|
-
137
|
1048
|
-
138
|
1049
|
-
139
|
1050
1051
|
140
|
1051
1052
|
141
|
1052
1053
|
142
|
@@ -1057,10 +1058,13 @@ socket|). Passes kwargs to #read_match. This method SHOULD NOT be used if
|
|
1057
1058
|
147
|
1058
1059
|
148
|
1059
1060
|
149
|
1060
|
-
150
|
1061
|
+
150
|
1062
|
+
151
|
1063
|
+
152
|
1064
|
+
153</pre>
|
1061
1065
|
</td>
|
1062
1066
|
<td>
|
1063
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
1067
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 140</span>
|
1064
1068
|
|
1065
1069
|
<span class='kw'>def</span> <span class='id identifier rubyid_run_match'>run_match</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span>
|
1066
1070
|
<span class='ivar'>@match_listener</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>
|
@@ -1107,13 +1111,13 @@ socket|). Passes kwargs to #read_match. This method SHOULD NOT be used if
|
|
1107
1111
|
<pre class="lines">
|
1108
1112
|
|
1109
1113
|
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
+
175
|
1115
|
+
176
|
1116
|
+
177
|
1117
|
+
178</pre>
|
1114
1118
|
</td>
|
1115
1119
|
<td>
|
1116
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line
|
1120
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/extension/io.rb', line 175</span>
|
1117
1121
|
|
1118
1122
|
<span class='kw'>def</span> <span class='id identifier rubyid_unregister_observer'>unregister_observer</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
1119
1123
|
<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>
|
@@ -1129,7 +1133,7 @@ socket|). Passes kwargs to #read_match. This method SHOULD NOT be used if
|
|
1129
1133
|
</div>
|
1130
1134
|
|
1131
1135
|
<div id="footer">
|
1132
|
-
Generated on
|
1136
|
+
Generated on Sat Apr 12 13:24:31 2014 by
|
1133
1137
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1134
1138
|
0.8.7.4 (ruby-2.1.1).
|
1135
1139
|
</div>
|
@@ -2519,7 +2519,7 @@ true. ( SO_LINGER )</p>
|
|
2519
2519
|
</div>
|
2520
2520
|
|
2521
2521
|
<div id="footer">
|
2522
|
-
Generated on
|
2522
|
+
Generated on Sat Apr 12 13:24:31 2014 by
|
2523
2523
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2524
2524
|
0.8.7.4 (ruby-2.1.1).
|
2525
2525
|
</div>
|
data/doc/Ionian/Extension.html
CHANGED
@@ -119,7 +119,7 @@
|
|
119
119
|
</div>
|
120
120
|
|
121
121
|
<div id="footer">
|
122
|
-
Generated on
|
122
|
+
Generated on Sat Apr 12 13:24:31 2014 by
|
123
123
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
124
124
|
0.8.7.4 (ruby-2.1.1).
|
125
125
|
</div>
|