ionian 0.6.8 → 0.6.9
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/doc/Ionian/Extension/IO.html +253 -89
- data/doc/Ionian/Extension/Socket.html +9 -9
- data/doc/Ionian/Extension.html +3 -3
- data/doc/Ionian/Server.html +3 -3
- data/doc/Ionian/Socket.html +464 -149
- data/doc/Ionian.html +3 -3
- data/doc/_index.html +4 -4
- data/doc/class_list.html +5 -1
- data/doc/file.README.html +25 -24
- data/doc/file.license.html +4 -4
- data/doc/file_list.html +5 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +25 -24
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +5 -1
- data/doc/top-level-namespace.html +3 -3
- data/lib/ionian/extension/io.rb +44 -29
- data/lib/ionian/extension/socket.rb +6 -6
- data/lib/ionian/socket.rb +79 -27
- data/license.txt +1 -1
- metadata +32 -4
data/doc/Ionian/Socket.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Ionian::Socket
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -276,7 +276,7 @@
|
|
276
276
|
<li class="public ">
|
277
277
|
<span class="summary_signature">
|
278
278
|
|
279
|
-
<a href="#cmd-instance_method" title="#cmd (instance method)">- (
|
279
|
+
<a href="#cmd-instance_method" title="#cmd (instance method)">- (Array<MatchData>) <strong>cmd</strong>(data, **kwargs) {|match| ... }</a>
|
280
280
|
|
281
281
|
|
282
282
|
|
@@ -396,7 +396,7 @@
|
|
396
396
|
<li class="public ">
|
397
397
|
<span class="summary_signature">
|
398
398
|
|
399
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Socket) <strong>initialize</strong>(existing_socket = nil, **kwargs) </a>
|
399
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Socket) <strong>initialize</strong>(existing_socket = nil, **kwargs) {|socket| ... }</a>
|
400
400
|
|
401
401
|
|
402
402
|
|
@@ -553,7 +553,7 @@ any string not already ending with one.</p>
|
|
553
553
|
<div class="method_details first">
|
554
554
|
<h3 class="signature first" id="initialize-instance_method">
|
555
555
|
|
556
|
-
- (<tt><span class='object_link'><a href="" title="Ionian::Socket (class)">Socket</a></span></tt>) <strong>initialize</strong>(existing_socket = nil, **kwargs)
|
556
|
+
- (<tt><span class='object_link'><a href="" title="Ionian::Socket (class)">Socket</a></span></tt>) <strong>initialize</strong>(existing_socket = nil, **kwargs) {|socket| ... }
|
557
557
|
|
558
558
|
|
559
559
|
|
@@ -564,30 +564,259 @@ any string not already ending with one.</p>
|
|
564
564
|
|
565
565
|
<p>Creates a new socket or wraps an existing socket.</p>
|
566
566
|
|
567
|
-
<p>Args:</p>
|
568
|
-
|
569
|
-
<pre class="code ruby"><code class="ruby">host: IP or hostname to connect to. Can contain the port in the format "host:port".
|
570
|
-
port: Connection's port number. Default is 23. Unused by :unix protocol.
|
571
|
-
protocol: Type of socket to create. :tcp, :udp, :unix. Default is :tcp.
|
572
|
-
:udp will be automatically selected for addresses in the multicast range.
|
573
|
-
persistent: The socket remains open after data is sent if this is true.
|
574
|
-
The socket closes after data is sent and a packet is received
|
575
|
-
if this is false. Default is true.
|
576
|
-
bind_port: Local UDP port to bind to for receiving data, if different than
|
577
|
-
the remote port being connected to.
|
578
|
-
reuse_addr: Set true to enable the SO_REUSEADDR flag. Allows local address reuse.
|
579
|
-
no_delay: Set true to enable the TCP_NODELAY flag. Disables Nagle algorithm.
|
580
|
-
cork: Set true to enable the TCP_CORK flag. Buffers multiple writes
|
581
|
-
into one segment.
|
582
|
-
linger: Set true to enable the SO_LINGER flag. When #close is called,
|
583
|
-
waits for the send buffer to empty before closing the socket.
|
584
|
-
expression: Overrides the #read_match regular expression for received data.</code></pre>
|
585
|
-
|
586
567
|
|
587
568
|
</div>
|
588
569
|
</div>
|
589
570
|
<div class="tags">
|
571
|
+
<p class="tag_title">Parameters:</p>
|
572
|
+
<ul class="param">
|
573
|
+
|
574
|
+
<li>
|
575
|
+
|
576
|
+
<span class='name'>existing_socket</span>
|
577
|
+
|
578
|
+
|
579
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Ionian::Socket (class)">Socket</a></span></tt>)</span>
|
580
|
+
|
581
|
+
|
582
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
583
|
+
|
584
|
+
|
585
|
+
—
|
586
|
+
<div class='inline'>
|
587
|
+
<p>An instantiated socket to be wrapped in and returned as an <span class='object_link'><a href="" title="Ionian::Socket (class)">Ionian::Socket</a></span>
|
588
|
+
(for example, TCPSocket). A new socket will be created if this parameter is
|
589
|
+
nil.</p>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
</li>
|
593
|
+
|
594
|
+
<li>
|
595
|
+
|
596
|
+
<span class='name'>kwargs</span>
|
597
|
+
|
598
|
+
|
599
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
—
|
604
|
+
<div class='inline'>
|
605
|
+
<p>:host is mandatory.</p>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
</li>
|
609
|
+
|
610
|
+
</ul>
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
<p class="tag_title">Options Hash (<tt>**kwargs</tt>):</p>
|
618
|
+
<ul class="option">
|
619
|
+
|
620
|
+
<li>
|
621
|
+
<span class="name">:host</span>
|
622
|
+
<span class="type">(<tt>String</tt>)</span>
|
623
|
+
<span class="default">
|
624
|
+
|
625
|
+
</span>
|
626
|
+
|
627
|
+
— <div class='inline'>
|
628
|
+
<p>IP or hostname to connect to. Can contain the port in the format
|
629
|
+
“host:port”.</p>
|
630
|
+
</div>
|
631
|
+
|
632
|
+
</li>
|
633
|
+
|
634
|
+
<li>
|
635
|
+
<span class="name">:port</span>
|
636
|
+
<span class="type">(<tt>Fixnum</tt>)</span>
|
637
|
+
<span class="default">
|
638
|
+
|
639
|
+
— default:
|
640
|
+
<tt>23</tt>
|
641
|
+
|
642
|
+
</span>
|
643
|
+
|
644
|
+
— <div class='inline'>
|
645
|
+
<p>Connection's port number. Unused by the :unix protocol.</p>
|
646
|
+
</div>
|
647
|
+
|
648
|
+
</li>
|
649
|
+
|
650
|
+
<li>
|
651
|
+
<span class="name">:protocol</span>
|
652
|
+
<span class="type">(<tt>:tcp</tt>, <tt>:udp</tt>, <tt>:unix</tt>)</span>
|
653
|
+
<span class="default">
|
654
|
+
|
655
|
+
— default:
|
656
|
+
<tt>:tcp</tt>
|
657
|
+
|
658
|
+
</span>
|
659
|
+
|
660
|
+
— <div class='inline'>
|
661
|
+
<p>Type of socket to create. :udp will be automatically selected for addresses
|
662
|
+
in the multicast range, or if the broadcast flag is set.</p>
|
663
|
+
</div>
|
664
|
+
|
665
|
+
</li>
|
666
|
+
|
667
|
+
<li>
|
668
|
+
<span class="name">:persistent</span>
|
669
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
670
|
+
<span class="default">
|
671
|
+
|
672
|
+
— default:
|
673
|
+
<tt>true</tt>
|
674
|
+
|
675
|
+
</span>
|
676
|
+
|
677
|
+
— <div class='inline'>
|
678
|
+
<p>The socket remains open after data is sent if this is true. The socket
|
679
|
+
closes after data is sent and a packet is received if this is false.</p>
|
680
|
+
</div>
|
681
|
+
|
682
|
+
</li>
|
683
|
+
|
684
|
+
<li>
|
685
|
+
<span class="name">:bind_port</span>
|
686
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
687
|
+
<span class="default">
|
688
|
+
|
689
|
+
— default:
|
690
|
+
<tt>:port</tt>
|
691
|
+
|
692
|
+
</span>
|
693
|
+
|
694
|
+
— <div class='inline'>
|
695
|
+
<p>Local UDP port to bind to for receiving data, if different than the remote
|
696
|
+
port being connected to.</p>
|
697
|
+
</div>
|
698
|
+
|
699
|
+
</li>
|
700
|
+
|
701
|
+
<li>
|
702
|
+
<span class="name">:broadcast</span>
|
703
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
704
|
+
<span class="default">
|
705
|
+
|
706
|
+
— default:
|
707
|
+
<tt>false</tt>
|
708
|
+
|
709
|
+
</span>
|
710
|
+
|
711
|
+
— <div class='inline'>
|
712
|
+
<p>Enable the SO_BROADCAST flag. Sets protocol to :udp implicitly.</p>
|
713
|
+
</div>
|
714
|
+
|
715
|
+
</li>
|
716
|
+
|
717
|
+
<li>
|
718
|
+
<span class="name">:reuse_addr</span>
|
719
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
720
|
+
<span class="default">
|
721
|
+
|
722
|
+
— default:
|
723
|
+
<tt>false</tt>
|
724
|
+
|
725
|
+
</span>
|
726
|
+
|
727
|
+
— <div class='inline'>
|
728
|
+
<p>Enable the SO_REUSEADDR flag. Allows local address reuse.</p>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
</li>
|
732
|
+
|
733
|
+
<li>
|
734
|
+
<span class="name">:no_delay</span>
|
735
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
736
|
+
<span class="default">
|
737
|
+
|
738
|
+
— default:
|
739
|
+
<tt>false</tt>
|
740
|
+
|
741
|
+
</span>
|
742
|
+
|
743
|
+
— <div class='inline'>
|
744
|
+
<p>Enable the TCP_NODELAY flag. Disables Nagle algorithm.</p>
|
745
|
+
</div>
|
746
|
+
|
747
|
+
</li>
|
748
|
+
|
749
|
+
<li>
|
750
|
+
<span class="name">:cork</span>
|
751
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
752
|
+
<span class="default">
|
753
|
+
|
754
|
+
— default:
|
755
|
+
<tt>false</tt>
|
756
|
+
|
757
|
+
</span>
|
758
|
+
|
759
|
+
— <div class='inline'>
|
760
|
+
<p>Enable the TCP_CORK flag. Buffers multiple writes into one segment.</p>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
</li>
|
764
|
+
|
765
|
+
<li>
|
766
|
+
<span class="name">:linger</span>
|
767
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
768
|
+
<span class="default">
|
769
|
+
|
770
|
+
— default:
|
771
|
+
<tt>false</tt>
|
772
|
+
|
773
|
+
</span>
|
774
|
+
|
775
|
+
— <div class='inline'>
|
776
|
+
<p>Enable the SO_LINGER flag. When #close is called, waits for the send buffer
|
777
|
+
to empty before closing the socket.</p>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
</li>
|
781
|
+
|
782
|
+
<li>
|
783
|
+
<span class="name">:expression</span>
|
784
|
+
<span class="type">(<tt>Regexp</tt>, <tt>String</tt>)</span>
|
785
|
+
<span class="default">
|
786
|
+
|
787
|
+
</span>
|
788
|
+
|
789
|
+
— <div class='inline'>
|
790
|
+
<p>Overrides the <span class='object_link'><a href="Extension/IO.html#read_match-instance_method" title="Ionian::Extension::IO#read_match (method)">Extension::IO#read_match</a></span> regular expression for
|
791
|
+
received data.</p>
|
792
|
+
</div>
|
793
|
+
|
794
|
+
</li>
|
795
|
+
|
796
|
+
</ul>
|
797
|
+
|
798
|
+
|
799
|
+
<p class="tag_title">Yield Parameters:</p>
|
800
|
+
<ul class="yieldparam">
|
801
|
+
|
802
|
+
<li>
|
803
|
+
|
804
|
+
<span class='name'>socket</span>
|
805
|
+
|
806
|
+
|
807
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Ionian::Socket (class)">Ionian::Socket</a></span></tt>)</span>
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
—
|
812
|
+
<div class='inline'>
|
813
|
+
<p>This socket is yielded to the block. Socket flushes and closes when exiting
|
814
|
+
the block.</p>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
</li>
|
590
818
|
|
819
|
+
</ul>
|
591
820
|
|
592
821
|
</div><table class="source_code">
|
593
822
|
<tr>
|
@@ -595,37 +824,6 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
595
824
|
<pre class="lines">
|
596
825
|
|
597
826
|
|
598
|
-
42
|
599
|
-
43
|
600
|
-
44
|
601
|
-
45
|
602
|
-
46
|
603
|
-
47
|
604
|
-
48
|
605
|
-
49
|
606
|
-
50
|
607
|
-
51
|
608
|
-
52
|
609
|
-
53
|
610
|
-
54
|
611
|
-
55
|
612
|
-
56
|
613
|
-
57
|
614
|
-
58
|
615
|
-
59
|
616
|
-
60
|
617
|
-
61
|
618
|
-
62
|
619
|
-
63
|
620
|
-
64
|
621
|
-
65
|
622
|
-
66
|
623
|
-
67
|
624
|
-
68
|
625
|
-
69
|
626
|
-
70
|
627
|
-
71
|
628
|
-
72
|
629
827
|
73
|
630
828
|
74
|
631
829
|
75
|
@@ -663,12 +861,54 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
663
861
|
107
|
664
862
|
108
|
665
863
|
109
|
666
|
-
110
|
864
|
+
110
|
865
|
+
111
|
866
|
+
112
|
867
|
+
113
|
868
|
+
114
|
869
|
+
115
|
870
|
+
116
|
871
|
+
117
|
872
|
+
118
|
873
|
+
119
|
874
|
+
120
|
875
|
+
121
|
876
|
+
122
|
877
|
+
123
|
878
|
+
124
|
879
|
+
125
|
880
|
+
126
|
881
|
+
127
|
882
|
+
128
|
883
|
+
129
|
884
|
+
130
|
885
|
+
131
|
886
|
+
132
|
887
|
+
133
|
888
|
+
134
|
889
|
+
135
|
890
|
+
136
|
891
|
+
137
|
892
|
+
138
|
893
|
+
139
|
894
|
+
140
|
895
|
+
141
|
896
|
+
142
|
897
|
+
143
|
898
|
+
144
|
899
|
+
145
|
900
|
+
146
|
901
|
+
147
|
902
|
+
148
|
903
|
+
149
|
904
|
+
150
|
905
|
+
151
|
906
|
+
152</pre>
|
667
907
|
</td>
|
668
908
|
<td>
|
669
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
909
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 73</span>
|
670
910
|
|
671
|
-
<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>
|
911
|
+
<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'>&</span><span class='id identifier rubyid_block'>block</span>
|
672
912
|
<span class='ivar'>@socket</span> <span class='op'>=</span> <span class='id identifier rubyid_existing_socket'>existing_socket</span>
|
673
913
|
|
674
914
|
<span class='ivar'>@ionian_listeners</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
@@ -696,7 +936,7 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
696
936
|
<span class='ivar'>@protocol</span> <span class='op'>=</span> <span class='symbol'>:unix</span>
|
697
937
|
<span class='kw'>end</span>
|
698
938
|
|
699
|
-
<span class='ivar'>@persistent</span>
|
939
|
+
<span class='ivar'>@persistent</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='comment'># Existing sockets are always persistent.
|
700
940
|
</span>
|
701
941
|
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_expression'>expression</span> <span class='op'>=</span> <span class='ivar'>@expression</span> <span class='kw'>if</span> <span class='ivar'>@expression</span>
|
702
942
|
|
@@ -710,12 +950,15 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
710
950
|
|
711
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>
|
712
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>
|
713
|
-
<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>
|
953
|
+
<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>
|
954
|
+
|
955
|
+
<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>
|
714
956
|
|
715
957
|
<span class='comment'># Automatically select UDP for the multicast range. Otherwise default to TCP.
|
716
958
|
</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:tcp</span>
|
717
959
|
<span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:udp</span> <span class='kw'>if</span> <span class='const'>Ionian</span><span class='op'>::</span><span class='const'>Extension</span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_multicast?'>multicast?</span> <span class='ivar'>@host</span>
|
718
960
|
<span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:unix</span> <span class='kw'>if</span> <span class='ivar'>@host</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span>
|
961
|
+
<span class='id identifier rubyid_default_protocol'>default_protocol</span> <span class='op'>=</span> <span class='symbol'>:udp</span> <span class='kw'>if</span> <span class='ivar'>@broadcast</span>
|
719
962
|
|
720
963
|
<span class='ivar'>@protocol</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'>:protocol</span><span class='comma'>,</span> <span class='id identifier rubyid_default_protocol'>default_protocol</span>
|
721
964
|
<span class='ivar'>@persistent</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'>:persistent</span><span class='comma'>,</span> <span class='kw'>true</span>
|
@@ -736,6 +979,14 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
736
979
|
|
737
980
|
<span class='id identifier rubyid_create_socket'>create_socket</span> <span class='kw'>if</span> <span class='ivar'>@persistent</span>
|
738
981
|
<span class='kw'>end</span>
|
982
|
+
|
983
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
|
984
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='kw'>self</span>
|
985
|
+
<span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
|
986
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
|
987
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
988
|
+
<span class='kw'>end</span>
|
989
|
+
<span class='kw'>end</span>
|
739
990
|
<span class='kw'>end</span></pre>
|
740
991
|
</td>
|
741
992
|
</tr>
|
@@ -970,13 +1221,13 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
970
1221
|
<pre class="lines">
|
971
1222
|
|
972
1223
|
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
1224
|
+
222
|
1225
|
+
223
|
1226
|
+
224
|
1227
|
+
225</pre>
|
977
1228
|
</td>
|
978
1229
|
<td>
|
979
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1230
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 222</span>
|
980
1231
|
|
981
1232
|
<span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
|
982
1233
|
<span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='ivar'>@socket</span>
|
@@ -990,7 +1241,7 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
990
1241
|
<div class="method_details ">
|
991
1242
|
<h3 class="signature " id="cmd-instance_method">
|
992
1243
|
|
993
|
-
- (<tt>
|
1244
|
+
- (<tt>Array<MatchData></tt>) <strong>cmd</strong>(data, **kwargs) {|match| ... }
|
994
1245
|
|
995
1246
|
|
996
1247
|
|
@@ -999,14 +1250,78 @@ expression: Overrides the #read_match regular expression for received data.</cod
|
|
999
1250
|
</h3><div class="docstring">
|
1000
1251
|
<div class="discussion">
|
1001
1252
|
|
1002
|
-
<p>Send a command (data) to the socket
|
1003
|
-
Block yields received match. See Ionian::Extension::IO#read_match.</p>
|
1253
|
+
<p>Send a command (data) to the socket.</p>
|
1004
1254
|
|
1005
1255
|
|
1006
1256
|
</div>
|
1007
1257
|
</div>
|
1008
1258
|
<div class="tags">
|
1259
|
+
<p class="tag_title">Parameters:</p>
|
1260
|
+
<ul class="param">
|
1261
|
+
|
1262
|
+
<li>
|
1263
|
+
|
1264
|
+
<span class='name'>kwargs</span>
|
1265
|
+
|
1266
|
+
|
1267
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1268
|
+
|
1269
|
+
|
1270
|
+
|
1271
|
+
—
|
1272
|
+
<div class='inline'>
|
1273
|
+
<p>Pass through to <span class='object_link'><a href="Extension/IO.html#read_match-instance_method" title="Ionian::Extension::IO#read_match (method)">Extension::IO#read_match</a></span>.</p>
|
1274
|
+
</div>
|
1275
|
+
|
1276
|
+
</li>
|
1277
|
+
|
1278
|
+
</ul>
|
1279
|
+
|
1280
|
+
<p class="tag_title">Yield Parameters:</p>
|
1281
|
+
<ul class="yieldparam">
|
1282
|
+
|
1283
|
+
<li>
|
1284
|
+
|
1285
|
+
<span class='name'>match</span>
|
1286
|
+
|
1287
|
+
|
1288
|
+
<span class='type'>(<tt>MatchData</tt>)</span>
|
1289
|
+
|
1290
|
+
|
1291
|
+
|
1292
|
+
—
|
1293
|
+
<div class='inline'>
|
1294
|
+
<p>Received match.</p>
|
1295
|
+
</div>
|
1296
|
+
|
1297
|
+
</li>
|
1009
1298
|
|
1299
|
+
</ul>
|
1300
|
+
<p class="tag_title">Returns:</p>
|
1301
|
+
<ul class="return">
|
1302
|
+
|
1303
|
+
<li>
|
1304
|
+
|
1305
|
+
|
1306
|
+
<span class='type'>(<tt>Array<MatchData></tt>)</span>
|
1307
|
+
|
1308
|
+
|
1309
|
+
|
1310
|
+
—
|
1311
|
+
<div class='inline'>
|
1312
|
+
<p>An array of received matches.</p>
|
1313
|
+
</div>
|
1314
|
+
|
1315
|
+
</li>
|
1316
|
+
|
1317
|
+
</ul>
|
1318
|
+
|
1319
|
+
<p class="tag_title">See Also:</p>
|
1320
|
+
<ul class="see">
|
1321
|
+
|
1322
|
+
<li><span class='object_link'><a href="Extension/IO.html#read_match-instance_method" title="Ionian::Extension::IO#read_match (method)">Extension::IO#read_match</a></span></li>
|
1323
|
+
|
1324
|
+
</ul>
|
1010
1325
|
|
1011
1326
|
</div><table class="source_code">
|
1012
1327
|
<tr>
|
@@ -1014,25 +1329,25 @@ Block yields received match. See Ionian::Extension::IO#read_match.</p>
|
|
1014
1329
|
<pre class="lines">
|
1015
1330
|
|
1016
1331
|
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1332
|
+
179
|
1333
|
+
180
|
1334
|
+
181
|
1335
|
+
182
|
1336
|
+
183
|
1337
|
+
184
|
1338
|
+
185
|
1339
|
+
186
|
1340
|
+
187
|
1341
|
+
188
|
1342
|
+
189</pre>
|
1028
1343
|
</td>
|
1029
1344
|
<td>
|
1030
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1345
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 179</span>
|
1031
1346
|
|
1032
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='id identifier
|
1347
|
+
<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'>&</span><span class='id identifier rubyid_block'>block</span>
|
1033
1348
|
<span class='id identifier rubyid_create_socket'>create_socket</span> <span class='kw'>unless</span> <span class='ivar'>@persistent</span>
|
1034
1349
|
|
1035
|
-
<span class='id identifier rubyid_write'>write</span> <span class='id identifier
|
1350
|
+
<span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_data'>data</span>
|
1036
1351
|
<span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
|
1037
1352
|
|
1038
1353
|
<span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_read_match'>read_match</span><span class='lparen'>(</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_match'>match</span><span class='op'>|</span> <span class='kw'>yield</span> <span class='id identifier rubyid_match'>match</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='rbrace'>}</span>
|
@@ -1071,12 +1386,12 @@ Block yields received match. See Ionian::Extension::IO#read_match.</p>
|
|
1071
1386
|
<pre class="lines">
|
1072
1387
|
|
1073
1388
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1389
|
+
155
|
1390
|
+
156
|
1391
|
+
157</pre>
|
1077
1392
|
</td>
|
1078
1393
|
<td>
|
1079
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1394
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 155</span>
|
1080
1395
|
|
1081
1396
|
<span class='kw'>def</span> <span class='id identifier rubyid_expression'>expression</span>
|
1082
1397
|
<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>
|
@@ -1112,13 +1427,13 @@ Block yields received match. See Ionian::Extension::IO#read_match.</p>
|
|
1112
1427
|
<pre class="lines">
|
1113
1428
|
|
1114
1429
|
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1430
|
+
160
|
1431
|
+
161
|
1432
|
+
162
|
1433
|
+
163</pre>
|
1119
1434
|
</td>
|
1120
1435
|
<td>
|
1121
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1436
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 160</span>
|
1122
1437
|
|
1123
1438
|
<span class='kw'>def</span> <span class='id identifier rubyid_expression='>expression=</span> <span class='id identifier rubyid_exp'>exp</span>
|
1124
1439
|
<span class='ivar'>@expression</span> <span class='op'>=</span> <span class='id identifier rubyid_exp'>exp</span>
|
@@ -1156,12 +1471,12 @@ non-persistent sockets.</p>
|
|
1156
1471
|
<pre class="lines">
|
1157
1472
|
|
1158
1473
|
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1474
|
+
229
|
1475
|
+
230
|
1476
|
+
231</pre>
|
1162
1477
|
</td>
|
1163
1478
|
<td>
|
1164
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1479
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 229</span>
|
1165
1480
|
|
1166
1481
|
<span class='kw'>def</span> <span class='id identifier rubyid_flush'>flush</span>
|
1167
1482
|
<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>
|
@@ -1213,13 +1528,13 @@ non-persistent sockets.</p>
|
|
1213
1528
|
<pre class="lines">
|
1214
1529
|
|
1215
1530
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1531
|
+
216
|
1532
|
+
217
|
1533
|
+
218
|
1534
|
+
219</pre>
|
1220
1535
|
</td>
|
1221
1536
|
<td>
|
1222
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1537
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 216</span>
|
1223
1538
|
|
1224
1539
|
<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>
|
1225
1540
|
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='ivar'>@socket</span>
|
@@ -1269,12 +1584,12 @@ non-persistent sockets.</p>
|
|
1269
1584
|
<pre class="lines">
|
1270
1585
|
|
1271
1586
|
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1587
|
+
166
|
1588
|
+
167
|
1589
|
+
168</pre>
|
1275
1590
|
</td>
|
1276
1591
|
<td>
|
1277
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1592
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 166</span>
|
1278
1593
|
|
1279
1594
|
<span class='kw'>def</span> <span class='id identifier rubyid_persistent?'>persistent?</span>
|
1280
1595
|
<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>
|
@@ -1311,12 +1626,12 @@ any string not already ending with one.</p>
|
|
1311
1626
|
<pre class="lines">
|
1312
1627
|
|
1313
1628
|
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1629
|
+
235
|
1630
|
+
236
|
1631
|
+
237</pre>
|
1317
1632
|
</td>
|
1318
1633
|
<td>
|
1319
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1634
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 235</span>
|
1320
1635
|
|
1321
1636
|
<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>
|
1322
1637
|
<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'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
@@ -1358,14 +1673,14 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
|
|
1358
1673
|
<pre class="lines">
|
1359
1674
|
|
1360
1675
|
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1676
|
+
195
|
1677
|
+
196
|
1678
|
+
197
|
1679
|
+
198
|
1680
|
+
199</pre>
|
1366
1681
|
</td>
|
1367
1682
|
<td>
|
1368
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1683
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 195</span>
|
1369
1684
|
|
1370
1685
|
<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>
|
1371
1686
|
<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>
|
@@ -1403,14 +1718,14 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
|
|
1403
1718
|
<pre class="lines">
|
1404
1719
|
|
1405
1720
|
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1721
|
+
204
|
1722
|
+
205
|
1723
|
+
206
|
1724
|
+
207
|
1725
|
+
208</pre>
|
1411
1726
|
</td>
|
1412
1727
|
<td>
|
1413
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1728
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 204</span>
|
1414
1729
|
|
1415
1730
|
<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>
|
1416
1731
|
<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>
|
@@ -1452,36 +1767,36 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
|
|
1452
1767
|
<pre class="lines">
|
1453
1768
|
|
1454
1769
|
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1770
|
+
241
|
1771
|
+
242
|
1772
|
+
243
|
1773
|
+
244
|
1774
|
+
245
|
1775
|
+
246
|
1776
|
+
247
|
1777
|
+
248
|
1778
|
+
249
|
1779
|
+
250
|
1780
|
+
251
|
1781
|
+
252
|
1782
|
+
253
|
1783
|
+
254
|
1784
|
+
255
|
1785
|
+
256
|
1786
|
+
257
|
1787
|
+
258
|
1788
|
+
259
|
1789
|
+
260
|
1790
|
+
261
|
1791
|
+
262
|
1792
|
+
263
|
1793
|
+
264
|
1794
|
+
265
|
1795
|
+
266
|
1796
|
+
267</pre>
|
1482
1797
|
</td>
|
1483
1798
|
<td>
|
1484
|
-
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line
|
1799
|
+
<pre class="code"><span class="info file"># File 'lib/ionian/socket.rb', line 241</span>
|
1485
1800
|
|
1486
1801
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_string'>string</span>
|
1487
1802
|
<span class='id identifier rubyid_create_socket'>create_socket</span> <span class='kw'>unless</span> <span class='ivar'>@persistent</span>
|
@@ -1520,9 +1835,9 @@ reference to the given block. block = ionian_socket.register_observer { … }</p
|
|
1520
1835
|
</div>
|
1521
1836
|
|
1522
1837
|
<div id="footer">
|
1523
|
-
Generated on
|
1838
|
+
Generated on Fri Oct 31 15:50:44 2014 by
|
1524
1839
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1525
|
-
0.8.7.
|
1840
|
+
0.8.7.6 (ruby-2.1.4).
|
1526
1841
|
</div>
|
1527
1842
|
|
1528
1843
|
</body>
|