ezmq 0.1.1

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.
@@ -0,0 +1,693 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: EZMQ::Subscriber
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!EZMQ/Subscriber.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (S)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../EZMQ.html" title="EZMQ (module)">EZMQ</a></span></span>
36
+ &raquo;
37
+ <span class="title">Subscriber</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: EZMQ::Subscriber
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next"><span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></li>
82
+
83
+ <li class="next">EZMQ::Subscriber</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/ezmq.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Subscribe socket that listens for messages with an optional topic.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
120
+ <ul class="summary">
121
+
122
+ <li class="public ">
123
+ <span class="summary_signature">
124
+
125
+ <a href="#action-instance_method" title="#action (instance method)">- (Object) <strong>action</strong> </a>
126
+
127
+
128
+
129
+ </span>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>Returns the value of attribute action.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ </ul>
150
+
151
+
152
+
153
+
154
+
155
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
156
+ <p class="inherited"><span class='object_link'><a href="Socket.html#context-instance_method" title="EZMQ::Socket#context (method)">#context</a></span>, <span class='object_link'><a href="Socket.html#decode-instance_method" title="EZMQ::Socket#decode (method)">#decode</a></span>, <span class='object_link'><a href="Socket.html#encode-instance_method" title="EZMQ::Socket#encode (method)">#encode</a></span>, <span class='object_link'><a href="Socket.html#socket-instance_method" title="EZMQ::Socket#socket (method)">#socket</a></span></p>
157
+
158
+
159
+
160
+ <h2>
161
+ Instance Method Summary
162
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
163
+ </h2>
164
+
165
+ <ul class="summary">
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Publisher) <strong>initialize</strong>(action: -&gt; m { m }, **options) </a>
171
+
172
+
173
+
174
+ </span>
175
+
176
+
177
+ <span class="note title constructor">constructor</span>
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>Creates a new Subscriber socket.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#listen-instance_method" title="#listen (instance method)">- (void) <strong>listen</strong>(handler: -&gt; { @action.call(receive) }) </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <span class="summary_desc"><div class='inline'>
211
+ <p>By default, waits for a message and calls @action with the message.</p>
212
+ </div></span>
213
+
214
+ </li>
215
+
216
+
217
+ <li class="public ">
218
+ <span class="summary_signature">
219
+
220
+ <a href="#subscribe-instance_method" title="#subscribe (instance method)">- (Boolean) <strong>subscribe</strong>(topic) </a>
221
+
222
+
223
+
224
+ </span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'>
235
+ <p>Establishes a new message filter on the socket.</p>
236
+ </div></span>
237
+
238
+ </li>
239
+
240
+
241
+ <li class="public ">
242
+ <span class="summary_signature">
243
+
244
+ <a href="#unsubscribe-instance_method" title="#unsubscribe (instance method)">- (Boolean) <strong>unsubscribe</strong>(topic) </a>
245
+
246
+
247
+
248
+ </span>
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+ <span class="summary_desc"><div class='inline'>
259
+ <p>Removes a message filter (as set with subscribe) from the socket.</p>
260
+ </div></span>
261
+
262
+ </li>
263
+
264
+
265
+ </ul>
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">Socket</a></span></h3>
278
+ <p class="inherited"><span class='object_link'><a href="Socket.html#bind-instance_method" title="EZMQ::Socket#bind (method)">#bind</a></span>, <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>
279
+ <div id="constructor_details" class="method_details_list">
280
+ <h2>Constructor Details</h2>
281
+
282
+ <div class="method_details first">
283
+ <h3 class="signature first" id="initialize-instance_method">
284
+
285
+ - (<tt><span class='object_link'><a href="Publisher.html" title="EZMQ::Publisher (class)">Publisher</a></span></tt>) <strong>initialize</strong>(action: -&gt; m { m }, **options)
286
+
287
+
288
+
289
+
290
+
291
+ </h3><div class="docstring">
292
+ <div class="discussion">
293
+
294
+ <p>Creates a new Subscriber socket.</p>
295
+
296
+
297
+ </div>
298
+ </div>
299
+ <div class="tags">
300
+ <p class="tag_title">Parameters:</p>
301
+ <ul class="param">
302
+
303
+ <li>
304
+
305
+ <span class='name'>action</span>
306
+
307
+
308
+ <span class='type'>(<tt>lambda</tt>)</span>
309
+
310
+
311
+
312
+ &mdash;
313
+ <div class='inline'>
314
+ <p>the action to perform when a message is received.</p>
315
+ </div>
316
+
317
+ </li>
318
+
319
+ <li>
320
+
321
+ <span class='name'>options</span>
322
+
323
+
324
+ <span class='type'>(<tt>Hash</tt>)</span>
325
+
326
+
327
+
328
+ &mdash;
329
+ <div class='inline'>
330
+ <p>optional parameters</p>
331
+ </div>
332
+
333
+ </li>
334
+
335
+ </ul>
336
+
337
+
338
+
339
+
340
+
341
+
342
+ <p class="tag_title">Options Hash (<tt>**options</tt>):</p>
343
+ <ul class="option">
344
+
345
+ <li>
346
+ <span class="name">topic</span>
347
+ <span class="type">(<tt>String</tt>)</span>
348
+ <span class="default">
349
+
350
+ </span>
351
+
352
+ &mdash; <div class='inline'>
353
+ <p>a topic to subscribe to.</p>
354
+ </div>
355
+
356
+ </li>
357
+
358
+ </ul>
359
+
360
+
361
+
362
+ <p class="tag_title">See Also:</p>
363
+ <ul class="see">
364
+
365
+ <li><span class='object_link'><a href="Socket.html" title="EZMQ::Socket (class)">EZMQ::Socket for a list of optional parameters.</a></span></li>
366
+
367
+ </ul>
368
+
369
+ </div><table class="source_code">
370
+ <tr>
371
+ <td>
372
+ <pre class="lines">
373
+
374
+
375
+ 185
376
+ 186
377
+ 187
378
+ 188
379
+ 189</pre>
380
+ </td>
381
+ <td>
382
+ <pre class="code"><span class="info file"># File 'lib/ezmq.rb', line 185</span>
383
+
384
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>action:</span> <span class='tlambda'>-&gt;</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><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
385
+ <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span>
386
+ <span class='kw'>super</span> <span class='symbol'>:connect</span><span class='comma'>,</span> <span class='const'>ZMQ</span><span class='op'>::</span><span class='const'>SUB</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span>
387
+ <span class='id identifier rubyid_subscribe'>subscribe</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:topic</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:topic</span><span class='rbracket'>]</span>
388
+ <span class='kw'>end</span></pre>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+
394
+ </div>
395
+
396
+ <div id="instance_attr_details" class="attr_details">
397
+ <h2>Instance Attribute Details</h2>
398
+
399
+
400
+ <span id="action=-instance_method"></span>
401
+ <div class="method_details first">
402
+ <h3 class="signature first" id="action-instance_method">
403
+
404
+ - (<tt>Object</tt>) <strong>action</strong>
405
+
406
+
407
+
408
+
409
+
410
+ </h3><div class="docstring">
411
+ <div class="discussion">
412
+
413
+ <p>Returns the value of attribute action</p>
414
+
415
+
416
+ </div>
417
+ </div>
418
+ <div class="tags">
419
+
420
+
421
+ </div><table class="source_code">
422
+ <tr>
423
+ <td>
424
+ <pre class="lines">
425
+
426
+
427
+ 172
428
+ 173
429
+ 174</pre>
430
+ </td>
431
+ <td>
432
+ <pre class="code"><span class="info file"># File 'lib/ezmq.rb', line 172</span>
433
+
434
+ <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span>
435
+ <span class='ivar'>@action</span>
436
+ <span class='kw'>end</span></pre>
437
+ </td>
438
+ </tr>
439
+ </table>
440
+ </div>
441
+
442
+ </div>
443
+
444
+
445
+ <div id="instance_method_details" class="method_details_list">
446
+ <h2>Instance Method Details</h2>
447
+
448
+
449
+ <div class="method_details first">
450
+ <h3 class="signature first" id="listen-instance_method">
451
+
452
+ - (<tt>void</tt>) <strong>listen</strong>(handler: -&gt; { @action.call(receive) })
453
+
454
+
455
+
456
+
457
+
458
+ </h3><div class="docstring">
459
+ <div class="discussion">
460
+ <p class="note returns_void">This method returns an undefined value.</p>
461
+ <p>By default, waits for a message and calls @action with the message.</p>
462
+
463
+
464
+ </div>
465
+ </div>
466
+ <div class="tags">
467
+ <p class="tag_title">Parameters:</p>
468
+ <ul class="param">
469
+
470
+ <li>
471
+
472
+ <span class='name'>handler</span>
473
+
474
+
475
+ <span class='type'>(<tt>lambda</tt>)</span>
476
+
477
+
478
+
479
+ &mdash;
480
+ <div class='inline'>
481
+ <p>how requests are handled.</p>
482
+ </div>
483
+
484
+ </li>
485
+
486
+ </ul>
487
+
488
+
489
+ </div><table class="source_code">
490
+ <tr>
491
+ <td>
492
+ <pre class="lines">
493
+
494
+
495
+ 223
496
+ 224
497
+ 225</pre>
498
+ </td>
499
+ <td>
500
+ <pre class="code"><span class="info file"># File 'lib/ezmq.rb', line 223</span>
501
+
502
+ <span class='kw'>def</span> <span class='id identifier rubyid_listen'>listen</span><span class='lparen'>(</span><span class='label'>handler:</span> <span class='tlambda'>-&gt;</span> <span class='tlambeg'>{</span> <span class='ivar'>@action</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_receive'>receive</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
503
+ <span class='id identifier rubyid_loop'>loop</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_handler'>handler</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='rbrace'>}</span>
504
+ <span class='kw'>end</span></pre>
505
+ </td>
506
+ </tr>
507
+ </table>
508
+ </div>
509
+
510
+ <div class="method_details ">
511
+ <h3 class="signature " id="subscribe-instance_method">
512
+
513
+ - (<tt>Boolean</tt>) <strong>subscribe</strong>(topic)
514
+
515
+
516
+
517
+
518
+
519
+ </h3><div class="docstring">
520
+ <div class="discussion">
521
+
522
+ <div class="note notetag">
523
+ <strong>Note:</strong>
524
+ <div class='inline'>
525
+ <p>By default, a Subscriber filters all incoming messages. Without</p>
526
+ </div>
527
+ </div>
528
+
529
+
530
+ <p>Establishes a new message filter on the socket.</p>
531
+
532
+ <p>calling subscribe at least once, no messages will be accepted. If topic was
533
+ provided, #initialize calls #subscribe automatically.</p>
534
+
535
+ <p>prefix will be accepted.</p>
536
+
537
+
538
+ </div>
539
+ </div>
540
+ <div class="tags">
541
+ <p class="tag_title">Parameters:</p>
542
+ <ul class="param">
543
+
544
+ <li>
545
+
546
+ <span class='name'>topic</span>
547
+
548
+
549
+ <span class='type'>(<tt>String</tt>)</span>
550
+
551
+
552
+
553
+ &mdash;
554
+ <div class='inline'>
555
+ <p>a topic to subscribe to. Messages matching this</p>
556
+ </div>
557
+
558
+ </li>
559
+
560
+ </ul>
561
+
562
+ <p class="tag_title">Returns:</p>
563
+ <ul class="return">
564
+
565
+ <li>
566
+
567
+
568
+ <span class='type'>(<tt>Boolean</tt>)</span>
569
+
570
+
571
+
572
+ &mdash;
573
+ <div class='inline'>
574
+ <p>was subscription successful?</p>
575
+ </div>
576
+
577
+ </li>
578
+
579
+ </ul>
580
+
581
+ </div><table class="source_code">
582
+ <tr>
583
+ <td>
584
+ <pre class="lines">
585
+
586
+
587
+ 202
588
+ 203
589
+ 204</pre>
590
+ </td>
591
+ <td>
592
+ <pre class="code"><span class="info file"># File 'lib/ezmq.rb', line 202</span>
593
+
594
+ <span class='kw'>def</span> <span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_topic'>topic</span><span class='rparen'>)</span>
595
+ <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_setsockopt'>setsockopt</span><span class='lparen'>(</span><span class='const'>ZMQ</span><span class='op'>::</span><span class='const'>SUBSCRIBE</span><span class='comma'>,</span> <span class='id identifier rubyid_topic'>topic</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
596
+ <span class='kw'>end</span></pre>
597
+ </td>
598
+ </tr>
599
+ </table>
600
+ </div>
601
+
602
+ <div class="method_details ">
603
+ <h3 class="signature " id="unsubscribe-instance_method">
604
+
605
+ - (<tt>Boolean</tt>) <strong>unsubscribe</strong>(topic)
606
+
607
+
608
+
609
+
610
+
611
+ </h3><div class="docstring">
612
+ <div class="discussion">
613
+
614
+ <p>Removes a message filter (as set with subscribe) from the socket.</p>
615
+
616
+
617
+ </div>
618
+ </div>
619
+ <div class="tags">
620
+ <p class="tag_title">Parameters:</p>
621
+ <ul class="param">
622
+
623
+ <li>
624
+
625
+ <span class='name'>topic</span>
626
+
627
+
628
+ <span class='type'>(<tt>String</tt>)</span>
629
+
630
+
631
+
632
+ &mdash;
633
+ <div class='inline'>
634
+ <p>the topic to unsubscribe from. If multiple filters with the same topic are
635
+ set, this will only remove one.</p>
636
+ </div>
637
+
638
+ </li>
639
+
640
+ </ul>
641
+
642
+ <p class="tag_title">Returns:</p>
643
+ <ul class="return">
644
+
645
+ <li>
646
+
647
+
648
+ <span class='type'>(<tt>Boolean</tt>)</span>
649
+
650
+
651
+
652
+ &mdash;
653
+ <div class='inline'>
654
+ <p>was unsubscription successful?</p>
655
+ </div>
656
+
657
+ </li>
658
+
659
+ </ul>
660
+
661
+ </div><table class="source_code">
662
+ <tr>
663
+ <td>
664
+ <pre class="lines">
665
+
666
+
667
+ 213
668
+ 214
669
+ 215</pre>
670
+ </td>
671
+ <td>
672
+ <pre class="code"><span class="info file"># File 'lib/ezmq.rb', line 213</span>
673
+
674
+ <span class='kw'>def</span> <span class='id identifier rubyid_unsubscribe'>unsubscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_topic'>topic</span><span class='rparen'>)</span>
675
+ <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_setsockopt'>setsockopt</span><span class='lparen'>(</span><span class='const'>ZMQ</span><span class='op'>::</span><span class='const'>UNSUBSCRIBE</span><span class='comma'>,</span> <span class='id identifier rubyid_topic'>topic</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
676
+ <span class='kw'>end</span></pre>
677
+ </td>
678
+ </tr>
679
+ </table>
680
+ </div>
681
+
682
+ </div>
683
+
684
+ </div>
685
+
686
+ <div id="footer">
687
+ Generated on Tue Jan 6 11:26:34 2015 by
688
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
689
+ 0.8.7.6 (ruby-2.0.0).
690
+ </div>
691
+
692
+ </body>
693
+ </html>