ezmq 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/doc/EZMQ.html +1 -1
- data/doc/EZMQ/Client.html +2 -2
- data/doc/EZMQ/Publisher.html +6 -4
- data/doc/EZMQ/Puller.html +2 -2
- data/doc/EZMQ/Pusher.html +2 -2
- data/doc/EZMQ/Server.html +2 -2
- data/doc/EZMQ/Socket.html +32 -165
- data/doc/EZMQ/Subscriber.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +24 -30
- data/doc/top-level-namespace.html +1 -1
- data/ezmq.gemspec +1 -1
- data/lib/ezmq/publish.rb +2 -1
- data/lib/ezmq/socket.rb +10 -20
- 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: 0721e0391f882680e4f73fcc5295bfedd482dfec
|
4
|
+
data.tar.gz: baf37ebe2485358af17f9da721c35465997b946f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3d0fe28ed2a44809ac5e792d8d8464d349f0d4f4ca96f6bedf764cd5cea73739399de090045b39835429859d3a9c9c64b64824fc9d156b453965167a3b27bb9
|
7
|
+
data.tar.gz: df39c39da00ababada368e2fedd1029b982eb40260679488a3025b2d6bdfc10a6f80d300bf59f0fa0774d0fec75a4e85929ab6f0033ddfd6140bb34716518df0
|
data/Gemfile
CHANGED
data/doc/EZMQ.html
CHANGED
@@ -119,7 +119,7 @@
|
|
119
119
|
</div>
|
120
120
|
|
121
121
|
<div id="footer">
|
122
|
-
Generated on
|
122
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
123
123
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
124
124
|
0.8.7.6 (ruby-2.0.0).
|
125
125
|
</div>
|
data/doc/EZMQ/Client.html
CHANGED
@@ -195,7 +195,7 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
198
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
198
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#listen-instance_method" title="EZMQ::Socket#listen (method)">#listen</a></span>, <span class='object_link'><a href="Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span>, <span class='object_link'><a href="Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span></p>
|
199
199
|
<div id="constructor_details" class="method_details_list">
|
200
200
|
<h2>Constructor Details</h2>
|
201
201
|
|
@@ -405,7 +405,7 @@
|
|
405
405
|
</div>
|
406
406
|
|
407
407
|
<div id="footer">
|
408
|
-
Generated on
|
408
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
409
409
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
410
410
|
0.8.7.6 (ruby-2.0.0).
|
411
411
|
</div>
|
data/doc/EZMQ/Publisher.html
CHANGED
@@ -195,7 +195,7 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
198
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
198
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#listen-instance_method" title="EZMQ::Socket#listen (method)">#listen</a></span>, <span class='object_link'><a href="Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span></p>
|
199
199
|
<div id="constructor_details" class="method_details_list">
|
200
200
|
<h2>Constructor Details</h2>
|
201
201
|
|
@@ -400,13 +400,15 @@
|
|
400
400
|
|
401
401
|
27
|
402
402
|
28
|
403
|
-
29
|
403
|
+
29
|
404
|
+
30</pre>
|
404
405
|
</td>
|
405
406
|
<td>
|
406
407
|
<pre class="code"><span class="info file"># File 'lib/ezmq/publish.rb', line 27</span>
|
407
408
|
|
408
409
|
<span class='kw'>def</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>topic:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
409
|
-
<span class='
|
410
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_topic'>topic</span> <span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:encode</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='ivar'>@encode</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_message'>message</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
411
|
+
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_send_string'>send_string</span> <span class='id identifier rubyid_message'>message</span>
|
410
412
|
<span class='kw'>end</span></pre>
|
411
413
|
</td>
|
412
414
|
</tr>
|
@@ -418,7 +420,7 @@
|
|
418
420
|
</div>
|
419
421
|
|
420
422
|
<div id="footer">
|
421
|
-
Generated on
|
423
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
422
424
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
423
425
|
0.8.7.6 (ruby-2.0.0).
|
424
426
|
</div>
|
data/doc/EZMQ/Puller.html
CHANGED
@@ -171,7 +171,7 @@
|
|
171
171
|
|
172
172
|
|
173
173
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
174
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
174
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#listen-instance_method" title="EZMQ::Socket#listen (method)">#listen</a></span>, <span class='object_link'><a href="Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span>, <span class='object_link'><a href="Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span></p>
|
175
175
|
<div id="constructor_details" class="method_details_list">
|
176
176
|
<h2>Constructor Details</h2>
|
177
177
|
|
@@ -267,7 +267,7 @@
|
|
267
267
|
</div>
|
268
268
|
|
269
269
|
<div id="footer">
|
270
|
-
Generated on
|
270
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
271
271
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
272
272
|
0.8.7.6 (ruby-2.0.0).
|
273
273
|
</div>
|
data/doc/EZMQ/Pusher.html
CHANGED
@@ -171,7 +171,7 @@
|
|
171
171
|
|
172
172
|
|
173
173
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
174
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
174
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#listen-instance_method" title="EZMQ::Socket#listen (method)">#listen</a></span>, <span class='object_link'><a href="Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span>, <span class='object_link'><a href="Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span></p>
|
175
175
|
<div id="constructor_details" class="method_details_list">
|
176
176
|
<h2>Constructor Details</h2>
|
177
177
|
|
@@ -267,7 +267,7 @@
|
|
267
267
|
</div>
|
268
268
|
|
269
269
|
<div id="footer">
|
270
|
-
Generated on
|
270
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
271
271
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
272
272
|
0.8.7.6 (ruby-2.0.0).
|
273
273
|
</div>
|
data/doc/EZMQ/Server.html
CHANGED
@@ -195,7 +195,7 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
198
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
198
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span>, <span class='object_link'><a href="Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span></p>
|
199
199
|
<div id="constructor_details" class="method_details_list">
|
200
200
|
<h2>Constructor Details</h2>
|
201
201
|
|
@@ -390,7 +390,7 @@
|
|
390
390
|
</div>
|
391
391
|
|
392
392
|
<div id="footer">
|
393
|
-
Generated on
|
393
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
394
394
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
395
395
|
0.8.7.6 (ruby-2.0.0).
|
396
396
|
</div>
|
data/doc/EZMQ/Socket.html
CHANGED
@@ -245,34 +245,12 @@
|
|
245
245
|
<li class="public ">
|
246
246
|
<span class="summary_signature">
|
247
247
|
|
248
|
-
<a href="#bind-instance_method" title="#bind (instance method)">- (Boolean) <strong>bind</strong>(protocol: 'tcp', address: '127.0.0.1', port: 5555) </a>
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
</span>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
<span class="summary_desc"><div class='inline'>
|
263
|
-
<p>Binds the socket to the given address.</p>
|
264
|
-
</div></span>
|
265
|
-
|
266
|
-
</li>
|
267
|
-
|
268
|
-
|
269
|
-
<li class="public ">
|
270
|
-
<span class="summary_signature">
|
271
|
-
|
272
248
|
<a href="#connect-instance_method" title="#connect (instance method)">- (Boolean) <strong>connect</strong>(protocol: 'tcp', address: '127.0.0.1', port: 5555) </a>
|
273
249
|
|
274
250
|
|
275
251
|
|
252
|
+
(also: #bind)
|
253
|
+
|
276
254
|
</span>
|
277
255
|
|
278
256
|
|
@@ -594,12 +572,12 @@
|
|
594
572
|
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line 24</span>
|
595
573
|
|
596
574
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
597
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='const'>ArgumentError</span> <span class='kw'>unless</span> <span class='
|
575
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='const'>ArgumentError</span> <span class='kw'>unless</span> <span class='qsymbols_beg'>%i(</span><span class='tstring_content'>bind</span><span class='words_sep'> </span><span class='tstring_content'>connect</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_mode'>mode</span>
|
598
576
|
<span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:context</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>ZMQ</span><span class='op'>::</span><span class='const'>Context</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
599
577
|
<span class='ivar'>@socket</span> <span class='op'>=</span> <span class='ivar'>@context</span><span class='period'>.</span><span class='id identifier rubyid_socket'>socket</span> <span class='id identifier rubyid_type'>type</span>
|
600
578
|
<span class='ivar'>@encode</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:encode</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tlambda'>-></span> <span class='id identifier rubyid_m'>m</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_m'>m</span> <span class='rbrace'>}</span>
|
601
579
|
<span class='ivar'>@decode</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:decode</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tlambda'>-></span> <span class='id identifier rubyid_m'>m</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_m'>m</span> <span class='rbrace'>}</span>
|
602
|
-
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='
|
580
|
+
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='qsymbols_beg'>%i(</span><span class='tstring_content'>protocol</span><span class='words_sep'> </span><span class='tstring_content'>address</span><span class='words_sep'> </span><span class='tstring_content'>port</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_k'>k</span> <span class='rbrace'>}</span>
|
603
581
|
<span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_endpoint'>endpoint</span>
|
604
582
|
<span class='kw'>end</span></pre>
|
605
583
|
</td>
|
@@ -792,12 +770,16 @@
|
|
792
770
|
|
793
771
|
|
794
772
|
<div class="method_details first">
|
795
|
-
<h3 class="signature first" id="
|
773
|
+
<h3 class="signature first" id="connect-instance_method">
|
796
774
|
|
797
|
-
- (<tt>Boolean</tt>) <strong>
|
775
|
+
- (<tt>Boolean</tt>) <strong>connect</strong>(protocol: 'tcp', address: '127.0.0.1', port: 5555)
|
798
776
|
|
799
777
|
|
800
778
|
|
779
|
+
<span class="aliases">Also known as:
|
780
|
+
<span class="names"><span id='bind-instance_method'>bind</span></span>
|
781
|
+
</span>
|
782
|
+
|
801
783
|
|
802
784
|
|
803
785
|
</h3><div class="docstring">
|
@@ -806,134 +788,19 @@
|
|
806
788
|
<div class="note notetag">
|
807
789
|
<strong>Note:</strong>
|
808
790
|
<div class='inline'>
|
809
|
-
<p>
|
810
|
-
|
791
|
+
<p>This method can be called as #bind, in which case it binds to the specified
|
792
|
+
address instead.</p>
|
811
793
|
</div>
|
812
794
|
</div>
|
813
795
|
|
814
796
|
<div class="note notetag">
|
815
797
|
<strong>Note:</strong>
|
816
798
|
<div class='inline'>
|
817
|
-
<p>
|
799
|
+
<p>Binding to 'localhost' is not consistent on all platforms. Prefer
|
800
|
+
'127.0.0.1' instead.</p>
|
818
801
|
</div>
|
819
802
|
</div>
|
820
803
|
|
821
|
-
|
822
|
-
<p>Binds the socket to the given address.</p>
|
823
|
-
|
824
|
-
|
825
|
-
</div>
|
826
|
-
</div>
|
827
|
-
<div class="tags">
|
828
|
-
<p class="tag_title">Parameters:</p>
|
829
|
-
<ul class="param">
|
830
|
-
|
831
|
-
<li>
|
832
|
-
|
833
|
-
<span class='name'>protocol</span>
|
834
|
-
|
835
|
-
|
836
|
-
<span class='type'>(<tt>String</tt>)</span>
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
—
|
841
|
-
<div class='inline'>
|
842
|
-
<p>('tcp') protocol for transport.</p>
|
843
|
-
</div>
|
844
|
-
|
845
|
-
</li>
|
846
|
-
|
847
|
-
<li>
|
848
|
-
|
849
|
-
<span class='name'>address</span>
|
850
|
-
|
851
|
-
|
852
|
-
<span class='type'>(<tt>String</tt>)</span>
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
—
|
857
|
-
<div class='inline'>
|
858
|
-
<p>('127.0.0.1') address for endpoint.</p>
|
859
|
-
</div>
|
860
|
-
|
861
|
-
</li>
|
862
|
-
|
863
|
-
<li>
|
864
|
-
|
865
|
-
<span class='name'>port</span>
|
866
|
-
|
867
|
-
|
868
|
-
<span class='type'>(<tt>Fixnum</tt>)</span>
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
—
|
873
|
-
<div class='inline'>
|
874
|
-
<p>(5555) port for endpoint.</p>
|
875
|
-
</div>
|
876
|
-
|
877
|
-
</li>
|
878
|
-
|
879
|
-
</ul>
|
880
|
-
|
881
|
-
<p class="tag_title">Returns:</p>
|
882
|
-
<ul class="return">
|
883
|
-
|
884
|
-
<li>
|
885
|
-
|
886
|
-
|
887
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
—
|
892
|
-
<div class='inline'>
|
893
|
-
<p>was binding successful?</p>
|
894
|
-
</div>
|
895
|
-
|
896
|
-
</li>
|
897
|
-
|
898
|
-
</ul>
|
899
|
-
|
900
|
-
</div><table class="source_code">
|
901
|
-
<tr>
|
902
|
-
<td>
|
903
|
-
<pre class="lines">
|
904
|
-
|
905
|
-
|
906
|
-
83
|
907
|
-
84
|
908
|
-
85
|
909
|
-
86
|
910
|
-
87</pre>
|
911
|
-
</td>
|
912
|
-
<td>
|
913
|
-
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line 83</span>
|
914
|
-
|
915
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='label'>protocol:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tcp</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>address:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>port:</span> <span class='int'>5555</span><span class='rparen'>)</span>
|
916
|
-
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_protocol'>protocol</span> <span class='embexpr_end'>}</span><span class='tstring_content'>://</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_address'>address</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
917
|
-
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_endpoint'>endpoint</span> <span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_port'>port</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>tcp</span><span class='words_sep'> </span><span class='tstring_content'>udp</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_protocol'>protocol</span>
|
918
|
-
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='id identifier rubyid_endpoint'>endpoint</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='int'>0</span>
|
919
|
-
<span class='kw'>end</span></pre>
|
920
|
-
</td>
|
921
|
-
</tr>
|
922
|
-
</table>
|
923
|
-
</div>
|
924
|
-
|
925
|
-
<div class="method_details ">
|
926
|
-
<h3 class="signature " id="connect-instance_method">
|
927
|
-
|
928
|
-
- (<tt>Boolean</tt>) <strong>connect</strong>(protocol: 'tcp', address: '127.0.0.1', port: 5555)
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
</h3><div class="docstring">
|
935
|
-
<div class="discussion">
|
936
|
-
|
937
804
|
<div class="note notetag">
|
938
805
|
<strong>Note:</strong>
|
939
806
|
<div class='inline'>
|
@@ -1026,19 +893,19 @@
|
|
1026
893
|
<pre class="lines">
|
1027
894
|
|
1028
895
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
896
|
+
86
|
897
|
+
87
|
898
|
+
88
|
899
|
+
89
|
900
|
+
90</pre>
|
1034
901
|
</td>
|
1035
902
|
<td>
|
1036
|
-
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line
|
903
|
+
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line 86</span>
|
1037
904
|
|
1038
905
|
<span class='kw'>def</span> <span class='id identifier rubyid_connect'>connect</span><span class='lparen'>(</span><span class='label'>protocol:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tcp</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>address:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>port:</span> <span class='int'>5555</span><span class='rparen'>)</span>
|
1039
906
|
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_protocol'>protocol</span> <span class='embexpr_end'>}</span><span class='tstring_content'>://</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_address'>address</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1040
907
|
<span class='id identifier rubyid_endpoint'>endpoint</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_endpoint'>endpoint</span> <span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_port'>port</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>tcp</span><span class='words_sep'> </span><span class='tstring_content'>udp</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_protocol'>protocol</span>
|
1041
|
-
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier
|
908
|
+
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid___callee__'>__callee__</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_endpoint'>endpoint</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='int'>0</span>
|
1042
909
|
<span class='kw'>end</span></pre>
|
1043
910
|
</td>
|
1044
911
|
</tr>
|
@@ -1109,18 +976,18 @@
|
|
1109
976
|
<pre class="lines">
|
1110
977
|
|
1111
978
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
979
|
+
101
|
980
|
+
102
|
981
|
+
103
|
982
|
+
104
|
983
|
+
105
|
984
|
+
106
|
985
|
+
107
|
986
|
+
108
|
987
|
+
109</pre>
|
1121
988
|
</td>
|
1122
989
|
<td>
|
1123
|
-
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line
|
990
|
+
<pre class="code"><span class="info file"># File 'lib/ezmq/socket.rb', line 101</span>
|
1124
991
|
|
1125
992
|
<span class='kw'>def</span> <span class='id identifier rubyid_listen'>listen</span>
|
1126
993
|
<span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
|
@@ -1433,7 +1300,7 @@
|
|
1433
1300
|
</div>
|
1434
1301
|
|
1435
1302
|
<div id="footer">
|
1436
|
-
Generated on
|
1303
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
1437
1304
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1438
1305
|
0.8.7.6 (ruby-2.0.0).
|
1439
1306
|
</div>
|
data/doc/EZMQ/Subscriber.html
CHANGED
@@ -299,7 +299,7 @@
|
|
299
299
|
|
300
300
|
|
301
301
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
|
302
|
-
<p class="inherited"><span class='object_link'><a href="Socket.html#
|
302
|
+
<p class="inherited"><span class='object_link'><a href="Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>, <span class='object_link'><a href="Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span></p>
|
303
303
|
<div id="constructor_details" class="method_details_list">
|
304
304
|
<h2>Constructor Details</h2>
|
305
305
|
|
@@ -927,7 +927,7 @@ set, this will only remove one.</p>
|
|
927
927
|
</div>
|
928
928
|
|
929
929
|
<div id="footer">
|
930
|
-
Generated on
|
930
|
+
Generated on Wed Jan 28 09:03:20 2015 by
|
931
931
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
932
932
|
0.8.7.6 (ruby-2.0.0).
|
933
933
|
</div>
|
data/doc/_index.html
CHANGED
@@ -174,7 +174,7 @@
|
|
174
174
|
</div>
|
175
175
|
|
176
176
|
<div id="footer">
|
177
|
-
Generated on
|
177
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
178
178
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
179
179
|
0.8.7.6 (ruby-2.0.0).
|
180
180
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -230,7 +230,7 @@ sudo aptitude install libzmq3-dev
|
|
230
230
|
</div></div>
|
231
231
|
|
232
232
|
<div id="footer">
|
233
|
-
Generated on
|
233
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
234
234
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
235
235
|
0.8.7.6 (ruby-2.0.0).
|
236
236
|
</div>
|
data/doc/index.html
CHANGED
@@ -230,7 +230,7 @@ sudo aptitude install libzmq3-dev
|
|
230
230
|
</div></div>
|
231
231
|
|
232
232
|
<div id="footer">
|
233
|
-
Generated on
|
233
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
234
234
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
235
235
|
0.8.7.6 (ruby-2.0.0).
|
236
236
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -58,44 +58,44 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
<li class="r2 ">
|
61
|
-
<span class='object_link'><a href="EZMQ/Socket.html#
|
61
|
+
<span class='object_link'><a href="EZMQ/Socket.html#connect-instance_method" title="EZMQ::Socket#connect (method)">#connect</a></span>
|
62
62
|
<small>EZMQ::Socket</small>
|
63
63
|
</li>
|
64
64
|
|
65
65
|
|
66
66
|
<li class="r1 ">
|
67
|
-
<span class='object_link'><a href="EZMQ/Socket.html#
|
67
|
+
<span class='object_link'><a href="EZMQ/Socket.html#context-instance_method" title="EZMQ::Socket#context (method)">#context</a></span>
|
68
68
|
<small>EZMQ::Socket</small>
|
69
69
|
</li>
|
70
70
|
|
71
71
|
|
72
72
|
<li class="r2 ">
|
73
|
-
<span class='object_link'><a href="EZMQ/Socket.html#
|
73
|
+
<span class='object_link'><a href="EZMQ/Socket.html#decode-instance_method" title="EZMQ::Socket#decode (method)">#decode</a></span>
|
74
74
|
<small>EZMQ::Socket</small>
|
75
75
|
</li>
|
76
76
|
|
77
77
|
|
78
78
|
<li class="r1 ">
|
79
|
-
<span class='object_link'><a href="EZMQ/Socket.html#
|
79
|
+
<span class='object_link'><a href="EZMQ/Socket.html#encode-instance_method" title="EZMQ::Socket#encode (method)">#encode</a></span>
|
80
80
|
<small>EZMQ::Socket</small>
|
81
81
|
</li>
|
82
82
|
|
83
83
|
|
84
84
|
<li class="r2 ">
|
85
|
-
<span class='object_link'><a href="EZMQ/
|
86
|
-
<small>EZMQ::
|
85
|
+
<span class='object_link'><a href="EZMQ/Puller.html#initialize-instance_method" title="EZMQ::Puller#initialize (method)">#initialize</a></span>
|
86
|
+
<small>EZMQ::Puller</small>
|
87
87
|
</li>
|
88
88
|
|
89
89
|
|
90
90
|
<li class="r1 ">
|
91
|
-
<span class='object_link'><a href="EZMQ/
|
92
|
-
<small>EZMQ::
|
91
|
+
<span class='object_link'><a href="EZMQ/Subscriber.html#initialize-instance_method" title="EZMQ::Subscriber#initialize (method)">#initialize</a></span>
|
92
|
+
<small>EZMQ::Subscriber</small>
|
93
93
|
</li>
|
94
94
|
|
95
95
|
|
96
96
|
<li class="r2 ">
|
97
|
-
<span class='object_link'><a href="EZMQ/
|
98
|
-
<small>EZMQ::
|
97
|
+
<span class='object_link'><a href="EZMQ/Server.html#initialize-instance_method" title="EZMQ::Server#initialize (method)">#initialize</a></span>
|
98
|
+
<small>EZMQ::Server</small>
|
99
99
|
</li>
|
100
100
|
|
101
101
|
|
@@ -112,84 +112,78 @@
|
|
112
112
|
|
113
113
|
|
114
114
|
<li class="r1 ">
|
115
|
-
<span class='object_link'><a href="EZMQ/Publisher.html#initialize-instance_method" title="EZMQ::Publisher#initialize (method)">#initialize</a></span>
|
116
|
-
<small>EZMQ::Publisher</small>
|
117
|
-
</li>
|
118
|
-
|
119
|
-
|
120
|
-
<li class="r2 ">
|
121
115
|
<span class='object_link'><a href="EZMQ/Pusher.html#initialize-instance_method" title="EZMQ::Pusher#initialize (method)">#initialize</a></span>
|
122
116
|
<small>EZMQ::Pusher</small>
|
123
117
|
</li>
|
124
118
|
|
125
119
|
|
126
|
-
<li class="
|
127
|
-
<span class='object_link'><a href="EZMQ/
|
128
|
-
<small>EZMQ::
|
120
|
+
<li class="r2 ">
|
121
|
+
<span class='object_link'><a href="EZMQ/Publisher.html#initialize-instance_method" title="EZMQ::Publisher#initialize (method)">#initialize</a></span>
|
122
|
+
<small>EZMQ::Publisher</small>
|
129
123
|
</li>
|
130
124
|
|
131
125
|
|
132
|
-
<li class="
|
126
|
+
<li class="r1 ">
|
133
127
|
<span class='object_link'><a href="EZMQ/Socket.html#listen-instance_method" title="EZMQ::Socket#listen (method)">#listen</a></span>
|
134
128
|
<small>EZMQ::Socket</small>
|
135
129
|
</li>
|
136
130
|
|
137
131
|
|
138
|
-
<li class="
|
132
|
+
<li class="r2 ">
|
139
133
|
<span class='object_link'><a href="EZMQ/Subscriber.html#listen-instance_method" title="EZMQ::Subscriber#listen (method)">#listen</a></span>
|
140
134
|
<small>EZMQ::Subscriber</small>
|
141
135
|
</li>
|
142
136
|
|
143
137
|
|
144
|
-
<li class="
|
138
|
+
<li class="r1 ">
|
145
139
|
<span class='object_link'><a href="EZMQ/Server.html#listen-instance_method" title="EZMQ::Server#listen (method)">#listen</a></span>
|
146
140
|
<small>EZMQ::Server</small>
|
147
141
|
</li>
|
148
142
|
|
149
143
|
|
150
|
-
<li class="
|
144
|
+
<li class="r2 ">
|
151
145
|
<span class='object_link'><a href="EZMQ/Socket.html#receive-instance_method" title="EZMQ::Socket#receive (method)">#receive</a></span>
|
152
146
|
<small>EZMQ::Socket</small>
|
153
147
|
</li>
|
154
148
|
|
155
149
|
|
156
|
-
<li class="
|
150
|
+
<li class="r1 ">
|
157
151
|
<span class='object_link'><a href="EZMQ/Subscriber.html#receive-instance_method" title="EZMQ::Subscriber#receive (method)">#receive</a></span>
|
158
152
|
<small>EZMQ::Subscriber</small>
|
159
153
|
</li>
|
160
154
|
|
161
155
|
|
162
|
-
<li class="
|
156
|
+
<li class="r2 ">
|
163
157
|
<span class='object_link'><a href="EZMQ/Client.html#request-instance_method" title="EZMQ::Client#request (method)">#request</a></span>
|
164
158
|
<small>EZMQ::Client</small>
|
165
159
|
</li>
|
166
160
|
|
167
161
|
|
168
|
-
<li class="
|
162
|
+
<li class="r1 ">
|
169
163
|
<span class='object_link'><a href="EZMQ/Publisher.html#send-instance_method" title="EZMQ::Publisher#send (method)">#send</a></span>
|
170
164
|
<small>EZMQ::Publisher</small>
|
171
165
|
</li>
|
172
166
|
|
173
167
|
|
174
|
-
<li class="
|
168
|
+
<li class="r2 ">
|
175
169
|
<span class='object_link'><a href="EZMQ/Socket.html#send-instance_method" title="EZMQ::Socket#send (method)">#send</a></span>
|
176
170
|
<small>EZMQ::Socket</small>
|
177
171
|
</li>
|
178
172
|
|
179
173
|
|
180
|
-
<li class="
|
174
|
+
<li class="r1 ">
|
181
175
|
<span class='object_link'><a href="EZMQ/Socket.html#socket-instance_method" title="EZMQ::Socket#socket (method)">#socket</a></span>
|
182
176
|
<small>EZMQ::Socket</small>
|
183
177
|
</li>
|
184
178
|
|
185
179
|
|
186
|
-
<li class="
|
180
|
+
<li class="r2 ">
|
187
181
|
<span class='object_link'><a href="EZMQ/Subscriber.html#subscribe-instance_method" title="EZMQ::Subscriber#subscribe (method)">#subscribe</a></span>
|
188
182
|
<small>EZMQ::Subscriber</small>
|
189
183
|
</li>
|
190
184
|
|
191
185
|
|
192
|
-
<li class="
|
186
|
+
<li class="r1 ">
|
193
187
|
<span class='object_link'><a href="EZMQ/Subscriber.html#unsubscribe-instance_method" title="EZMQ::Subscriber#unsubscribe (method)">#unsubscribe</a></span>
|
194
188
|
<small>EZMQ::Subscriber</small>
|
195
189
|
</li>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Wed Jan 28 09:03:19 2015 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.0.0).
|
109
109
|
</div>
|
data/ezmq.gemspec
CHANGED
data/lib/ezmq/publish.rb
CHANGED
@@ -25,7 +25,8 @@ module EZMQ
|
|
25
25
|
# @return [Fixnum] the size of the message.
|
26
26
|
#
|
27
27
|
def send(message = '', topic: '', **options)
|
28
|
-
|
28
|
+
message = "#{ topic } #{ (options[:encode] || @encode).call message }"
|
29
|
+
@socket.send_string message
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/ezmq/socket.rb
CHANGED
@@ -22,12 +22,12 @@ module EZMQ
|
|
22
22
|
# @return [Socket] a new instance of Socket.
|
23
23
|
#
|
24
24
|
def initialize(mode, type, **options)
|
25
|
-
fail ArgumentError unless
|
25
|
+
fail ArgumentError unless %i(bind connect).include? mode
|
26
26
|
@context = options[:context] || ZMQ::Context.new
|
27
27
|
@socket = @context.socket type
|
28
28
|
@encode = options[:encode] || -> m { m }
|
29
29
|
@decode = options[:decode] || -> m { m }
|
30
|
-
endpoint = options.select { |k, _|
|
30
|
+
endpoint = options.select { |k, _| %i(protocol address port).include? k }
|
31
31
|
method(mode).call endpoint
|
32
32
|
end
|
33
33
|
|
@@ -69,27 +69,15 @@ module EZMQ
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
# Binds the socket to the given address.
|
73
|
-
#
|
74
|
-
# @param [String] protocol ('tcp') protocol for transport.
|
75
|
-
# @param [String] address ('127.0.0.1') address for endpoint.
|
76
|
-
# @note An address of 'localhost' is not reliable on all platforms.
|
77
|
-
# Prefer '127.0.0.1' instead.
|
78
|
-
# @param [Fixnum] port (5555) port for endpoint.
|
79
|
-
# @note port is ignored unless protocol is either 'tcp' or 'udp'.
|
80
|
-
#
|
81
|
-
# @return [Boolean] was binding successful?
|
82
|
-
#
|
83
|
-
def bind(protocol: 'tcp', address: '127.0.0.1', port: 5555)
|
84
|
-
endpoint = "#{ protocol }://#{ address }"
|
85
|
-
endpoint = "#{ endpoint }:#{ port }" if %w(tcp udp).include? protocol
|
86
|
-
@socket.bind(endpoint) == 0
|
87
|
-
end
|
88
|
-
|
89
72
|
# Connects the socket to the given address.
|
90
73
|
#
|
74
|
+
# @note This method can be called as #bind, in which case it binds to the
|
75
|
+
# specified address instead.
|
76
|
+
#
|
91
77
|
# @param [String] protocol ('tcp') protocol for transport.
|
92
78
|
# @param [String] address ('127.0.0.1') address for endpoint.
|
79
|
+
# @note Binding to 'localhost' is not consistent on all platforms.
|
80
|
+
# Prefer '127.0.0.1' instead.
|
93
81
|
# @param [Fixnum] port (5555) port for endpoint.
|
94
82
|
# @note port is ignored unless protocol is either 'tcp' or 'udp'.
|
95
83
|
#
|
@@ -98,9 +86,11 @@ module EZMQ
|
|
98
86
|
def connect(protocol: 'tcp', address: '127.0.0.1', port: 5555)
|
99
87
|
endpoint = "#{ protocol }://#{ address }"
|
100
88
|
endpoint = "#{ endpoint }:#{ port }" if %w(tcp udp).include? protocol
|
101
|
-
@socket.
|
89
|
+
@socket.method(__callee__).call(endpoint) == 0
|
102
90
|
end
|
103
91
|
|
92
|
+
alias_method :bind, :connect
|
93
|
+
|
104
94
|
# By default, waits for a message and prints it to STDOUT.
|
105
95
|
#
|
106
96
|
# @yield message passes the message received to the block.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi-rzmq
|