YkESet 0.99.7 → 0.99.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5be659b099e48d1f5b3bdb95895583b7c77f4c9dff7d89c544364397bbd5fbd6
4
- data.tar.gz: 4fce39a829bbc3dfd7957d830919c8fb56c6c4a31ab2948a9aff0752e6ee3f38
3
+ metadata.gz: 7e07f6b289a0481ea87f3ebbadda79385902561588a5b175b3bc021c473ddb5f
4
+ data.tar.gz: 2e09d66e8ea52db188d07f94c226851ab3a68519f0b13d7eb432241ccc9335be
5
5
  SHA512:
6
- metadata.gz: 560f95629d6edf49539417dea32e6fe85b5a07a6d7d4666a05593ce648543497f92ef7a7e3fb12ab43ed53cc175742dbf61646d782b5856385d6304784f6dd63
7
- data.tar.gz: 9643af79c646cbb710cc7c0c39bbf7145a7ba0c77b70ab78426614aed3d4e2b07651488b258d5252bcf402e244ede0e583504d850539667b7cd194855a44def9
6
+ metadata.gz: 7e900c7edb69dde2bc6b6babc7f6050b4c9d9710b0fab6aa9c7581d29ad1e88678bccf6f87c7f24e9231374b11124c29544170c741800393a0d9304a55ab95bf
7
+ data.tar.gz: f31d39a654955db6a04add4a615a633e5a44814b584f901b43b47796210a470276b9b73ffb0ca75386238f186dc866d562a641f543cd7f6e6b8266ce2fcb09c6
data/README.md CHANGED
@@ -23,8 +23,9 @@ Or install it yourself as:
23
23
  require 'Yk/ESet'
24
24
  include Yk
25
25
 
26
+
26
27
  class Foo
27
- attr :f
28
+ attr :f
28
29
  def initialize f
29
30
  @f = f
30
31
  end
@@ -34,21 +35,49 @@ Or install it yourself as:
34
35
  o.f
35
36
  end
36
37
 
37
- s.insert Foo.new(rand)
38
- s.insert Foo.new(rand)
39
- s.insert Foo.new(rand)
40
- s.insert Foo.new(rand)
41
-
38
+ # add method does not return iterator object (much efficient)
39
+ s.add Foo.new(rand)
40
+ s.add Foo.new(rand)
41
+ s.add Foo.new(rand)
42
+ s.add Foo.new(rand)
43
+
44
+ y = rand
45
+ result = s.add Foo.new(y)
46
+ p result # true
47
+ result = s.add Foo.new(y)
48
+ p result # false
49
+
42
50
  ESet.for_each s.begin, s.end do |foo|
43
51
  p foo.f
44
52
  end
45
-
53
+
54
+ # insert method returns iterator object
55
+ it, result = s.insert Foo.new(y = rand)
56
+ p result # true
57
+ it, result = s.insert Foo.new(y)
58
+ p result # false
59
+
60
+ s.erase it
61
+ p it.erased? # true
62
+ begin
63
+ s.erase it # wrongly erase twice
64
+ rescue ArgumentError
65
+ p $!
66
+ end
67
+
46
68
  it = s.begin
47
- while it != s.end
69
+ while !it.end?
48
70
  p it.item
49
71
  it.inc
50
72
  end
51
-
73
+
74
+ begin
75
+ it.item # already reached the end
76
+ rescue RangeError
77
+ p $!
78
+ end
79
+
80
+ # iterator is not value type but object type
52
81
  jt = it
53
82
  it.dec
54
83
  p it == jt #true
@@ -56,8 +85,6 @@ Or install it yourself as:
56
85
  jt.dec
57
86
  p it != jt #true
58
87
 
59
-
60
-
61
88
  See [Document page](https://yougaein.github.io/eset/index.html)
62
89
 
63
90
 
@@ -266,6 +266,54 @@
266
266
  <p>increment the position.</p>
267
267
  </div></span>
268
268
 
269
+ </li>
270
+
271
+
272
+ <li class="public ">
273
+ <span class="summary_signature">
274
+
275
+ <a href="#isEnd%3F-instance_method" title="#isEnd? (instance method)">#<strong>isEnd?</strong> &#x21d2; True|False </a>
276
+
277
+
278
+
279
+ </span>
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <span class="summary_desc"><div class='inline'>
290
+ <p>returns true if the iterator is already reached the end.</p>
291
+ </div></span>
292
+
293
+ </li>
294
+
295
+
296
+ <li class="public ">
297
+ <span class="summary_signature">
298
+
299
+ <a href="#isErased%3F-instance_method" title="#isErased? (instance method)">#<strong>isErased?</strong> &#x21d2; True|False </a>
300
+
301
+
302
+
303
+ </span>
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+ <span class="summary_desc"><div class='inline'>
314
+ <p>returns true if iterator position is already erased.</p>
315
+ </div></span>
316
+
269
317
  </li>
270
318
 
271
319
 
@@ -364,11 +412,11 @@
364
412
  <pre class="lines">
365
413
 
366
414
 
367
- 464
368
- 465</pre>
415
+ 576
416
+ 577</pre>
369
417
  </td>
370
418
  <td>
371
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 464</span>
419
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 576</span>
372
420
 
373
421
  <span class='kw'>def</span> <span class='op'>!=</span>
374
422
  <span class='kw'>end</span></pre>
@@ -439,11 +487,11 @@
439
487
  <pre class="lines">
440
488
 
441
489
 
442
- 459
443
- 460</pre>
490
+ 571
491
+ 572</pre>
444
492
  </td>
445
493
  <td>
446
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 459</span>
494
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 571</span>
447
495
 
448
496
  <span class='kw'>def</span> <span class='op'>==</span> <span class='id identifier rubyid_arg'>arg</span>
449
497
  <span class='kw'>end</span></pre>
@@ -514,11 +562,11 @@
514
562
  <pre class="lines">
515
563
 
516
564
 
517
- 454
518
- 455</pre>
565
+ 566
566
+ 567</pre>
519
567
  </td>
520
568
  <td>
521
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 454</span>
569
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 566</span>
522
570
 
523
571
  <span class='kw'>def</span> <span class='id identifier rubyid_assign'>assign</span> <span class='id identifier rubyid_arg'>arg</span>
524
572
  <span class='kw'>end</span></pre>
@@ -571,11 +619,11 @@
571
619
  <pre class="lines">
572
620
 
573
621
 
574
- 439
575
- 440</pre>
622
+ 540
623
+ 541</pre>
576
624
  </td>
577
625
  <td>
578
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 439</span>
626
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 540</span>
579
627
 
580
628
  <span class='kw'>def</span> <span class='id identifier rubyid_clone'>clone</span>
581
629
  <span class='kw'>end</span></pre>
@@ -634,6 +682,20 @@
634
682
 
635
683
  <div class='inline'>
636
684
  <p>RangeError raised when rewinding over the beginning</p>
685
+ </div>
686
+
687
+ </li>
688
+
689
+ <li>
690
+
691
+
692
+ <span class='type'></span>
693
+
694
+
695
+
696
+
697
+ <div class='inline'>
698
+ <p>ArgumentError raised when decrementing erased position</p>
637
699
  </div>
638
700
 
639
701
  </li>
@@ -646,11 +708,11 @@
646
708
  <pre class="lines">
647
709
 
648
710
 
649
- 449
650
- 450</pre>
711
+ 552
712
+ 553</pre>
651
713
  </td>
652
714
  <td>
653
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 449</span>
715
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 552</span>
654
716
 
655
717
  <span class='kw'>def</span> <span class='id identifier rubyid_dec'>dec</span>
656
718
  <span class='kw'>end</span></pre>
@@ -709,6 +771,20 @@
709
771
 
710
772
  <div class='inline'>
711
773
  <p>RangeError raised when advancing over the end</p>
774
+ </div>
775
+
776
+ </li>
777
+
778
+ <li>
779
+
780
+
781
+ <span class='type'></span>
782
+
783
+
784
+
785
+
786
+ <div class='inline'>
787
+ <p>ArgumentError raised when incrementing erased position</p>
712
788
  </div>
713
789
 
714
790
  </li>
@@ -721,17 +797,149 @@
721
797
  <pre class="lines">
722
798
 
723
799
 
724
- 444
725
- 445</pre>
800
+ 546
801
+ 547</pre>
726
802
  </td>
727
803
  <td>
728
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 444</span>
804
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 546</span>
729
805
 
730
806
  <span class='kw'>def</span> <span class='id identifier rubyid_inc'>inc</span>
731
807
  <span class='kw'>end</span></pre>
732
808
  </td>
733
809
  </tr>
734
810
  </table>
811
+ </div>
812
+
813
+ <div class="method_details ">
814
+ <h3 class="signature " id="isEnd?-instance_method">
815
+
816
+ #<strong>isEnd?</strong> &#x21d2; <tt>True|False</tt>
817
+
818
+
819
+
820
+
821
+
822
+ </h3><div class="docstring">
823
+ <div class="discussion">
824
+
825
+ <p>returns true if the iterator is already reached the end</p>
826
+
827
+
828
+ </div>
829
+ </div>
830
+ <div class="tags">
831
+
832
+ <p class="tag_title">Returns:</p>
833
+ <ul class="return">
834
+
835
+ <li>
836
+
837
+
838
+ <span class='type'>(<tt>True|False</tt>)</span>
839
+
840
+
841
+
842
+ &mdash;
843
+ <div class='inline'>
844
+ <p>true|false</p>
845
+ </div>
846
+
847
+ </li>
848
+
849
+ </ul>
850
+ <p class="tag_title">Raises:</p>
851
+ <ul class="raise">
852
+
853
+ <li>
854
+
855
+
856
+ <span class='type'></span>
857
+
858
+
859
+
860
+
861
+ <div class='inline'>
862
+ <p>ArgumentError raised when the pstion of the iterator is already erased</p>
863
+ </div>
864
+
865
+ </li>
866
+
867
+ </ul>
868
+
869
+ </div><table class="source_code">
870
+ <tr>
871
+ <td>
872
+ <pre class="lines">
873
+
874
+
875
+ 557
876
+ 558</pre>
877
+ </td>
878
+ <td>
879
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 557</span>
880
+
881
+ <span class='kw'>def</span> <span class='id identifier rubyid_isEnd?'>isEnd?</span>
882
+ <span class='kw'>end</span></pre>
883
+ </td>
884
+ </tr>
885
+ </table>
886
+ </div>
887
+
888
+ <div class="method_details ">
889
+ <h3 class="signature " id="isErased?-instance_method">
890
+
891
+ #<strong>isErased?</strong> &#x21d2; <tt>True|False</tt>
892
+
893
+
894
+
895
+
896
+
897
+ </h3><div class="docstring">
898
+ <div class="discussion">
899
+
900
+ <p>returns true if iterator position is already erased</p>
901
+
902
+
903
+ </div>
904
+ </div>
905
+ <div class="tags">
906
+
907
+ <p class="tag_title">Returns:</p>
908
+ <ul class="return">
909
+
910
+ <li>
911
+
912
+
913
+ <span class='type'>(<tt>True|False</tt>)</span>
914
+
915
+
916
+
917
+ &mdash;
918
+ <div class='inline'>
919
+ <p>true|false</p>
920
+ </div>
921
+
922
+ </li>
923
+
924
+ </ul>
925
+
926
+ </div><table class="source_code">
927
+ <tr>
928
+ <td>
929
+ <pre class="lines">
930
+
931
+
932
+ 561
933
+ 562</pre>
934
+ </td>
935
+ <td>
936
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 561</span>
937
+
938
+ <span class='kw'>def</span> <span class='id identifier rubyid_isErased?'>isErased?</span>
939
+ <span class='kw'>end</span></pre>
940
+ </td>
941
+ </tr>
942
+ </table>
735
943
  </div>
736
944
 
737
945
  <div class="method_details ">
@@ -778,11 +986,11 @@
778
986
  <pre class="lines">
779
987
 
780
988
 
781
- 468
782
- 469</pre>
989
+ 580
990
+ 581</pre>
783
991
  </td>
784
992
  <td>
785
- <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 468</span>
993
+ <pre class="code"><span class="info file"># File 'for_yard_product.rb', line 580</span>
786
994
 
787
995
  <span class='kw'>def</span> <span class='id identifier rubyid_item'>item</span>
788
996
  <span class='kw'>end</span></pre>
@@ -796,7 +1004,7 @@
796
1004
  </div>
797
1005
 
798
1006
  <div id="footer">
799
- Generated on Fri Feb 21 22:53:06 2020 by
1007
+ Generated on Sun Feb 23 08:31:41 2020 by
800
1008
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
801
1009
  0.9.24 (ruby-2.7.0).
802
1010
  </div>