rrlist 0.0.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,2277 @@
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: RRList::List
8
+
9
+ &mdash; Documentation by YARD 0.8.6.1
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#!" + escape(window.location.href);
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 (L)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../RRList.html" title="RRList (module)">RRList</a></span></span>
36
+ &raquo;
37
+ <span class="title">List</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: RRList::List
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">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">RRList::List</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/rrlist/list.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>
105
+ Represents a Round Robin List. You set the max number of items and the size
106
+ does not increse. While you add more items you lose the older items
107
+ </p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+ <p class="tag_title">Author:</p>
115
+ <ul class="author">
116
+
117
+ <li>
118
+
119
+
120
+
121
+
122
+
123
+ <div class='inline'><p>
124
+ Federico Dayan
125
+ </p>
126
+ </div>
127
+
128
+ </li>
129
+
130
+ </ul>
131
+
132
+ </div>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <h2>
141
+ Instance Method Summary
142
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
143
+ </h2>
144
+
145
+ <ul class="summary">
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#%3C%3C-instance_method" title="#&lt;&lt; (instance method)">- (Object) <strong>&lt;&lt;</strong>(value) </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <span class="summary_desc"><div class='inline'><p>
165
+ Adds a value to the end of the list.
166
+ </p>
167
+ </div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(index) </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc"><div class='inline'><p>
190
+ Returns the value for the given index.
191
+ </p>
192
+ </div></span>
193
+
194
+ </li>
195
+
196
+
197
+ <li class="public ">
198
+ <span class="summary_signature">
199
+
200
+ <a href="#%5B%5D%3D-instance_method" title="#[]= (instance method)">- (Object) <strong>[]=</strong>(index, value) </a>
201
+
202
+
203
+
204
+ </span>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <span class="summary_desc"><div class='inline'><p>
215
+ Sets a value to in the given index.
216
+ </p>
217
+ </div></span>
218
+
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#add-instance_method" title="#add (instance method)">- (Object) <strong>add</strong>(value) </a>
226
+
227
+
228
+
229
+ </span>
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+ <span class="summary_desc"><div class='inline'><p>
240
+ Adds a value to the next index position and moves the cursor forward.
241
+ </p>
242
+ </div></span>
243
+
244
+ </li>
245
+
246
+
247
+ <li class="public ">
248
+ <span class="summary_signature">
249
+
250
+ <a href="#add_at-instance_method" title="#add_at (instance method)">- (Object) <strong>add_at</strong>(index, value) </a>
251
+
252
+
253
+
254
+ </span>
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+ <span class="summary_desc"><div class='inline'><p>
265
+ Add an item to the specified postion and set the cursor to that position.
266
+ </p>
267
+ </div></span>
268
+
269
+ </li>
270
+
271
+
272
+ <li class="public ">
273
+ <span class="summary_signature">
274
+
275
+ <a href="#clear-instance_method" title="#clear (instance method)">- (Object) <strong>clear</strong> </a>
276
+
277
+
278
+
279
+ </span>
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <span class="summary_desc"><div class='inline'><p>
290
+ Sets all values to nil, but it does not move the cursor.
291
+ </p>
292
+ </div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong>(&amp;blk) </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'><p>
315
+ Iterates of over the values.
316
+ </p>
317
+ </div></span>
318
+
319
+ </li>
320
+
321
+
322
+ <li class="public ">
323
+ <span class="summary_signature">
324
+
325
+ <a href="#each_with_index-instance_method" title="#each_with_index (instance method)">- (Object) <strong>each_with_index</strong> </a>
326
+
327
+
328
+
329
+ </span>
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+ <span class="summary_desc"><div class='inline'><p>
340
+ Iterates of over the values.
341
+ </p>
342
+ </div></span>
343
+
344
+ </li>
345
+
346
+
347
+ <li class="public ">
348
+ <span class="summary_signature">
349
+
350
+ <a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(index) </a>
351
+
352
+
353
+
354
+ </span>
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+ <span class="summary_desc"><div class='inline'><p>
365
+ The value for the specified index.
366
+ </p>
367
+ </div></span>
368
+
369
+ </li>
370
+
371
+
372
+ <li class="public ">
373
+ <span class="summary_signature">
374
+
375
+ <a href="#higher%3F-instance_method" title="#higher? (instance method)">- (True) <strong>higher?</strong>(index) </a>
376
+
377
+
378
+
379
+ </span>
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+ <span class="summary_desc"><div class='inline'><p>
390
+ If the giving number is higher that the current max index.
391
+ </p>
392
+ </div></span>
393
+
394
+ </li>
395
+
396
+
397
+ <li class="public ">
398
+ <span class="summary_signature">
399
+
400
+ <a href="#in_limits%3F-instance_method" title="#in_limits? (instance method)">- (True) <strong>in_limits?</strong>(index) </a>
401
+
402
+
403
+
404
+ </span>
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+ <span class="summary_desc"><div class='inline'><p>
415
+ If the given number is in the limits of the current max an min index of the
416
+ list.
417
+ </p>
418
+ </div></span>
419
+
420
+ </li>
421
+
422
+
423
+ <li class="public ">
424
+ <span class="summary_signature">
425
+
426
+ <a href="#index_size-instance_method" title="#index_size (instance method)">- (Integer) <strong>index_size</strong> </a>
427
+
428
+
429
+
430
+ </span>
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+ <span class="summary_desc"><div class='inline'><p>
441
+ The index size of this list.
442
+ </p>
443
+ </div></span>
444
+
445
+ </li>
446
+
447
+
448
+ <li class="public ">
449
+ <span class="summary_signature">
450
+
451
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (List) <strong>initialize</strong>(options = {}) {|index, old_value, new_value| ... }</a>
452
+
453
+
454
+
455
+ </span>
456
+
457
+
458
+ <span class="note title constructor">constructor</span>
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+ <span class="summary_desc"><div class='inline'><p>
468
+ Creates an object.
469
+ </p>
470
+ </div></span>
471
+
472
+ </li>
473
+
474
+
475
+ <li class="public ">
476
+ <span class="summary_signature">
477
+
478
+ <a href="#lower%3F-instance_method" title="#lower? (instance method)">- (True) <strong>lower?</strong>(index) </a>
479
+
480
+
481
+
482
+ </span>
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+ <span class="summary_desc"><div class='inline'><p>
493
+ If the giving number is lower that the current min index.
494
+ </p>
495
+ </div></span>
496
+
497
+ </li>
498
+
499
+
500
+ <li class="public ">
501
+ <span class="summary_signature">
502
+
503
+ <a href="#max_index-instance_method" title="#max_index (instance method)">- (Integer) <strong>max_index</strong> </a>
504
+
505
+
506
+
507
+ </span>
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+ <span class="summary_desc"><div class='inline'><p>
518
+ The max indes of current list.
519
+ </p>
520
+ </div></span>
521
+
522
+ </li>
523
+
524
+
525
+ <li class="public ">
526
+ <span class="summary_signature">
527
+
528
+ <a href="#min_index-instance_method" title="#min_index (instance method)">- (Integer) <strong>min_index</strong> </a>
529
+
530
+
531
+
532
+ </span>
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+ <span class="summary_desc"><div class='inline'><p>
543
+ The min index of the current list.
544
+ </p>
545
+ </div></span>
546
+
547
+ </li>
548
+
549
+
550
+ <li class="public ">
551
+ <span class="summary_signature">
552
+
553
+ <a href="#out_of_range%3F-instance_method" title="#out_of_range? (instance method)">- (True) <strong>out_of_range?</strong>(index) </a>
554
+
555
+
556
+
557
+ </span>
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+ <span class="summary_desc"><div class='inline'><p>
568
+ If the given number is out of the range and all numbers will be lost if
569
+ set.
570
+ </p>
571
+ </div></span>
572
+
573
+ </li>
574
+
575
+
576
+ <li class="public ">
577
+ <span class="summary_signature">
578
+
579
+ <a href="#ranges-instance_method" title="#ranges (instance method)">- (Array&lt;Integer&gt;) <strong>ranges</strong> </a>
580
+
581
+
582
+
583
+ </span>
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+ <span class="summary_desc"><div class='inline'><p>
594
+ The min_index and max_index as a list.
595
+ </p>
596
+ </div></span>
597
+
598
+ </li>
599
+
600
+
601
+ <li class="public ">
602
+ <span class="summary_signature">
603
+
604
+ <a href="#remaining_in_slot-instance_method" title="#remaining_in_slot (instance method)">- (Integer) <strong>remaining_in_slot</strong> </a>
605
+
606
+
607
+
608
+ </span>
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+ <span class="summary_desc"><div class='inline'><p>
619
+ If range is used, returns the remaining numbers in the current position.
620
+ </p>
621
+ </div></span>
622
+
623
+ </li>
624
+
625
+
626
+ <li class="public ">
627
+ <span class="summary_signature">
628
+
629
+ <a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong> </a>
630
+
631
+
632
+
633
+ </span>
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+ <span class="summary_desc"><div class='inline'><p>
644
+ Reset this list, set all values to nil and move cursor to position 0.
645
+ </p>
646
+ </div></span>
647
+
648
+ </li>
649
+
650
+
651
+ <li class="public ">
652
+ <span class="summary_signature">
653
+
654
+ <a href="#set_at-instance_method" title="#set_at (instance method)">- (Object) <strong>set_at</strong>(index, value) </a>
655
+
656
+
657
+
658
+ </span>
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+ <span class="summary_desc"><div class='inline'><p>
669
+ Set the specified value in the given index.
670
+ </p>
671
+ </div></span>
672
+
673
+ </li>
674
+
675
+
676
+ <li class="public ">
677
+ <span class="summary_signature">
678
+
679
+ <a href="#to_s-instance_method" title="#to_s (instance method)">- (Object) <strong>to_s</strong> </a>
680
+
681
+
682
+
683
+ </span>
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+ <span class="summary_desc"><div class='inline'><p>
694
+ Pretty print this object.
695
+ </p>
696
+ </div></span>
697
+
698
+ </li>
699
+
700
+
701
+ <li class="public ">
702
+ <span class="summary_signature">
703
+
704
+ <a href="#values-instance_method" title="#values (instance method)">- (Array&lt;Object&gt;) <strong>values</strong> </a>
705
+
706
+
707
+
708
+ </span>
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+ <span class="summary_desc"><div class='inline'><p>
719
+ The values of this list.
720
+ </p>
721
+ </div></span>
722
+
723
+ </li>
724
+
725
+
726
+ </ul>
727
+
728
+
729
+ <div id="constructor_details" class="method_details_list">
730
+ <h2>Constructor Details</h2>
731
+
732
+ <div class="method_details first">
733
+ <h3 class="signature first" id="initialize-instance_method">
734
+
735
+ - (<tt><span class='object_link'><a href="" title="RRList::List (class)">List</a></span></tt>) <strong>initialize</strong>(options = {}) {|index, old_value, new_value| ... }
736
+
737
+
738
+
739
+
740
+
741
+ </h3><div class="docstring">
742
+ <div class="discussion">
743
+ <p>
744
+ Creates an object
745
+ </p>
746
+
747
+
748
+ </div>
749
+ </div>
750
+ <div class="tags">
751
+ <p class="tag_title">Parameters:</p>
752
+ <ul class="param">
753
+
754
+ <li>
755
+
756
+ <span class='name'>options</span>
757
+
758
+
759
+ <span class='type'>(<tt>Hash</tt>)</span>
760
+
761
+
762
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
763
+
764
+
765
+ </li>
766
+
767
+ </ul>
768
+
769
+
770
+
771
+
772
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
773
+ <ul class="option">
774
+
775
+ <li>
776
+ <span class="name">:size</span>
777
+ <span class="type">(<tt>Integer</tt>)</span>
778
+ <span class="default">
779
+
780
+ </span>
781
+
782
+ &mdash; <div class='inline'><p>
783
+ The size of the list. It does not add more elements than this.
784
+ </p>
785
+ </div>
786
+
787
+ </li>
788
+
789
+ <li>
790
+ <span class="name">:range</span>
791
+ <span class="type">(<tt>Integer</tt>)</span>
792
+ <span class="default">
793
+
794
+ </span>
795
+
796
+ &mdash; <div class='inline'><p>
797
+ The range of the list. A range of 5 group 5 indexes into one position.
798
+ </p>
799
+ </div>
800
+
801
+ </li>
802
+
803
+ <li>
804
+ <span class="name">:store</span>
805
+ <span class="type">(<tt>Integer</tt>)</span>
806
+ <span class="default">
807
+
808
+ </span>
809
+
810
+ &mdash; <div class='inline'><p>
811
+ Represents the where we save the data. It must follow a contract (see
812
+ RRList:Stores:InMemoryArray)
813
+ </p>
814
+ </div>
815
+
816
+ </li>
817
+
818
+ </ul>
819
+
820
+
821
+ <p class="tag_title">Yields:</p>
822
+ <ul class="yield">
823
+
824
+ <li>
825
+
826
+
827
+ <span class='type'>(<tt>index</tt>, <tt>old_value</tt>, <tt>new_value</tt>)</span>
828
+
829
+
830
+
831
+ </li>
832
+
833
+ </ul>
834
+
835
+ </div><table class="source_code">
836
+ <tr>
837
+ <td>
838
+ <pre class="lines">
839
+
840
+
841
+ 16
842
+ 17
843
+ 18
844
+ 19
845
+ 20
846
+ 21
847
+ 22
848
+ 23
849
+ 24
850
+ 25
851
+ 26
852
+ 27</pre>
853
+ </td>
854
+ <td>
855
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 16</span>
856
+
857
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span><span class='op'>&amp;</span><span class='id identifier rubyid_function_proc'>function_proc</span><span class='rparen'>)</span>
858
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:size is required</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:size</span><span class='rbracket'>]</span>
859
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:range should be greater thant 0</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range</span><span class='rbracket'>]</span> <span class='op'>&lt;</span> <span class='int'>1</span>
860
+
861
+ <span class='ivar'>@store</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:store</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>RRList</span><span class='op'>::</span><span class='const'>Stores</span><span class='op'>::</span><span class='const'>InMemoryArray</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
862
+ <span class='ivar'>@size</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:size</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
863
+ <span class='ivar'>@range</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>1</span>
864
+
865
+ <span class='id identifier rubyid_reset'>reset</span>
866
+
867
+ <span class='ivar'>@function_proc</span> <span class='op'>=</span> <span class='id identifier rubyid_function_proc'>function_proc</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
868
+ <span class='kw'>end</span></pre>
869
+ </td>
870
+ </tr>
871
+ </table>
872
+ </div>
873
+
874
+ </div>
875
+
876
+
877
+ <div id="instance_method_details" class="method_details_list">
878
+ <h2>Instance Method Details</h2>
879
+
880
+
881
+ <div class="method_details first">
882
+ <h3 class="signature first" id="<<-instance_method">
883
+
884
+ - (<tt>Object</tt>) <strong>&lt;&lt;</strong>(value)
885
+
886
+
887
+
888
+
889
+
890
+ </h3><div class="docstring">
891
+ <div class="discussion">
892
+ <p>
893
+ Adds a value to the end of the list.
894
+ </p>
895
+
896
+
897
+ </div>
898
+ </div>
899
+ <div class="tags">
900
+
901
+
902
+ <p class="tag_title">See Also:</p>
903
+ <ul class="see">
904
+
905
+ <li><span class='object_link'><a href="#add-instance_method" title="RRList::List#add (method)">#add</a></span></li>
906
+
907
+ </ul>
908
+
909
+ </div><table class="source_code">
910
+ <tr>
911
+ <td>
912
+ <pre class="lines">
913
+
914
+
915
+ 192
916
+ 193
917
+ 194</pre>
918
+ </td>
919
+ <td>
920
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 192</span>
921
+
922
+ <span class='kw'>def</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span>
923
+ <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
924
+ <span class='kw'>end</span></pre>
925
+ </td>
926
+ </tr>
927
+ </table>
928
+ </div>
929
+
930
+ <div class="method_details ">
931
+ <h3 class="signature " id="[]-instance_method">
932
+
933
+ - (<tt>Object</tt>) <strong>[]</strong>(index)
934
+
935
+
936
+
937
+
938
+
939
+ </h3><div class="docstring">
940
+ <div class="discussion">
941
+ <p>
942
+ Returns the value for the given index
943
+ </p>
944
+
945
+
946
+ </div>
947
+ </div>
948
+ <div class="tags">
949
+
950
+
951
+ <p class="tag_title">See Also:</p>
952
+ <ul class="see">
953
+
954
+ <li><span class='object_link'><a href="#get-instance_method" title="RRList::List#get (method)">#get</a></span></li>
955
+
956
+ </ul>
957
+
958
+ </div><table class="source_code">
959
+ <tr>
960
+ <td>
961
+ <pre class="lines">
962
+
963
+
964
+ 180
965
+ 181
966
+ 182</pre>
967
+ </td>
968
+ <td>
969
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 180</span>
970
+
971
+ <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
972
+ <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
973
+ <span class='kw'>end</span></pre>
974
+ </td>
975
+ </tr>
976
+ </table>
977
+ </div>
978
+
979
+ <div class="method_details ">
980
+ <h3 class="signature " id="[]=-instance_method">
981
+
982
+ - (<tt>Object</tt>) <strong>[]=</strong>(index, value)
983
+
984
+
985
+
986
+
987
+
988
+ </h3><div class="docstring">
989
+ <div class="discussion">
990
+ <p>
991
+ Sets a value to in the given index.
992
+ </p>
993
+
994
+
995
+ </div>
996
+ </div>
997
+ <div class="tags">
998
+
999
+
1000
+ <p class="tag_title">See Also:</p>
1001
+ <ul class="see">
1002
+
1003
+ <li><span class='object_link'><a href="#add_at-instance_method" title="RRList::List#add_at (method)">#add_at</a></span></li>
1004
+
1005
+ </ul>
1006
+
1007
+ </div><table class="source_code">
1008
+ <tr>
1009
+ <td>
1010
+ <pre class="lines">
1011
+
1012
+
1013
+ 186
1014
+ 187
1015
+ 188</pre>
1016
+ </td>
1017
+ <td>
1018
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 186</span>
1019
+
1020
+ <span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1021
+ <span class='id identifier rubyid_add_at'>add_at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1022
+ <span class='kw'>end</span></pre>
1023
+ </td>
1024
+ </tr>
1025
+ </table>
1026
+ </div>
1027
+
1028
+ <div class="method_details ">
1029
+ <h3 class="signature " id="add-instance_method">
1030
+
1031
+ - (<tt>Object</tt>) <strong>add</strong>(value)
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+ </h3><div class="docstring">
1038
+ <div class="discussion">
1039
+ <p>
1040
+ Adds a value to the next index position and moves the cursor forward
1041
+ </p>
1042
+
1043
+
1044
+ </div>
1045
+ </div>
1046
+ <div class="tags">
1047
+ <p class="tag_title">Parameters:</p>
1048
+ <ul class="param">
1049
+
1050
+ <li>
1051
+
1052
+ <span class='name'>value</span>
1053
+
1054
+
1055
+ <span class='type'></span>
1056
+
1057
+
1058
+
1059
+ &mdash;
1060
+ <div class='inline'><p>
1061
+ any object
1062
+ </p>
1063
+ </div>
1064
+
1065
+ </li>
1066
+
1067
+ </ul>
1068
+
1069
+
1070
+ </div><table class="source_code">
1071
+ <tr>
1072
+ <td>
1073
+ <pre class="lines">
1074
+
1075
+
1076
+ 98
1077
+ 99
1078
+ 100
1079
+ 101</pre>
1080
+ </td>
1081
+ <td>
1082
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 98</span>
1083
+
1084
+ <span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1085
+ <span class='ivar'>@add_at_next</span> <span class='op'>=</span> <span class='int'>0</span> <span class='kw'>unless</span> <span class='ivar'>@add_at_next</span>
1086
+ <span class='id identifier rubyid_add_at'>add_at</span> <span class='ivar'>@add_at_next</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span>
1087
+ <span class='kw'>end</span></pre>
1088
+ </td>
1089
+ </tr>
1090
+ </table>
1091
+ </div>
1092
+
1093
+ <div class="method_details ">
1094
+ <h3 class="signature " id="add_at-instance_method">
1095
+
1096
+ - (<tt>Object</tt>) <strong>add_at</strong>(index, value)
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+ </h3><div class="docstring">
1103
+ <div class="discussion">
1104
+ <p>
1105
+ Add an item to the specified postion and set the cursor to that position
1106
+ </p>
1107
+
1108
+
1109
+ </div>
1110
+ </div>
1111
+ <div class="tags">
1112
+ <p class="tag_title">Parameters:</p>
1113
+ <ul class="param">
1114
+
1115
+ <li>
1116
+
1117
+ <span class='name'>index</span>
1118
+
1119
+
1120
+ <span class='type'></span>
1121
+
1122
+
1123
+
1124
+ &mdash;
1125
+ <div class='inline'><p>
1126
+ must be higher than max_index
1127
+ </p>
1128
+ </div>
1129
+
1130
+ </li>
1131
+
1132
+ <li>
1133
+
1134
+ <span class='name'>value</span>
1135
+
1136
+
1137
+ <span class='type'></span>
1138
+
1139
+
1140
+
1141
+ &mdash;
1142
+ <div class='inline'><p>
1143
+ any object
1144
+ </p>
1145
+ </div>
1146
+
1147
+ </li>
1148
+
1149
+ </ul>
1150
+
1151
+
1152
+ </div><table class="source_code">
1153
+ <tr>
1154
+ <td>
1155
+ <pre class="lines">
1156
+
1157
+
1158
+ 106
1159
+ 107
1160
+ 108
1161
+ 109
1162
+ 110
1163
+ 111
1164
+ 112
1165
+ 113
1166
+ 114
1167
+ 115
1168
+ 116
1169
+ 117
1170
+ 118
1171
+ 119
1172
+ 120
1173
+ 121
1174
+ 122
1175
+ 123</pre>
1176
+ </td>
1177
+ <td>
1178
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 106</span>
1179
+
1180
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_at'>add_at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1181
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Index is lower that current index</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_index'>index</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_max_index'>max_index</span>
1182
+
1183
+ <span class='ivar'>@add_at_next</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span> <span class='op'>+</span> <span class='int'>1</span>
1184
+ <span class='id identifier rubyid_pos'>pos</span> <span class='op'>=</span> <span class='id identifier rubyid_position_for_index'>position_for_index</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1185
+
1186
+ <span class='kw'>if</span> <span class='id identifier rubyid_out_of_range?'>out_of_range?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1187
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_fill_with_nils'>fill_with_nils</span>
1188
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_higher?'>higher?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1189
+ <span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downto'>downto</span><span class='lparen'>(</span><span class='ivar'>@position</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span><span class='kw'>nil</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='kw'>if</span> <span class='ivar'>@current_index</span> <span class='op'>&gt;=</span> <span class='ivar'>@size</span>
1190
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span><span class='kw'>nil</span><span class='rparen'>)</span> <span class='comment'># We clean the value, if not it gets used by @before_add
1191
+ </span> <span class='kw'>end</span>
1192
+
1193
+ <span class='id identifier rubyid_set_value'>set_value</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1194
+ <span class='ivar'>@position</span> <span class='op'>=</span> <span class='id identifier rubyid_pos'>pos</span> <span class='op'>+</span> <span class='int'>1</span>
1195
+ <span class='ivar'>@current_index</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
1196
+ <span class='kw'>self</span>
1197
+ <span class='kw'>end</span></pre>
1198
+ </td>
1199
+ </tr>
1200
+ </table>
1201
+ </div>
1202
+
1203
+ <div class="method_details ">
1204
+ <h3 class="signature " id="clear-instance_method">
1205
+
1206
+ - (<tt>Object</tt>) <strong>clear</strong>
1207
+
1208
+
1209
+
1210
+
1211
+
1212
+ </h3><div class="docstring">
1213
+ <div class="discussion">
1214
+ <p>
1215
+ Sets all values to nil, but it does not move the cursor
1216
+ </p>
1217
+
1218
+
1219
+ </div>
1220
+ </div>
1221
+ <div class="tags">
1222
+
1223
+
1224
+ </div><table class="source_code">
1225
+ <tr>
1226
+ <td>
1227
+ <pre class="lines">
1228
+
1229
+
1230
+ 30
1231
+ 31
1232
+ 32</pre>
1233
+ </td>
1234
+ <td>
1235
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 30</span>
1236
+
1237
+ <span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
1238
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_fill'>fill</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span><span class='int'>0</span><span class='op'>...</span><span class='ivar'>@size</span><span class='rparen'>)</span>
1239
+ <span class='kw'>end</span></pre>
1240
+ </td>
1241
+ </tr>
1242
+ </table>
1243
+ </div>
1244
+
1245
+ <div class="method_details ">
1246
+ <h3 class="signature " id="each-instance_method">
1247
+
1248
+ - (<tt>Object</tt>) <strong>each</strong>(&amp;blk)
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+ </h3><div class="docstring">
1255
+ <div class="discussion">
1256
+ <p>
1257
+ Iterates of over the values. Expects a block and passes the value
1258
+ </p>
1259
+
1260
+
1261
+ </div>
1262
+ </div>
1263
+ <div class="tags">
1264
+
1265
+
1266
+ </div><table class="source_code">
1267
+ <tr>
1268
+ <td>
1269
+ <pre class="lines">
1270
+
1271
+
1272
+ 77
1273
+ 78
1274
+ 79</pre>
1275
+ </td>
1276
+ <td>
1277
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 77</span>
1278
+
1279
+ <span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
1280
+ <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
1281
+ <span class='kw'>end</span></pre>
1282
+ </td>
1283
+ </tr>
1284
+ </table>
1285
+ </div>
1286
+
1287
+ <div class="method_details ">
1288
+ <h3 class="signature " id="each_with_index-instance_method">
1289
+
1290
+ - (<tt>Object</tt>) <strong>each_with_index</strong>
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+ </h3><div class="docstring">
1297
+ <div class="discussion">
1298
+ <p>
1299
+ Iterates of over the values. Expects a block and passes the value and index
1300
+ </p>
1301
+
1302
+
1303
+ </div>
1304
+ </div>
1305
+ <div class="tags">
1306
+
1307
+
1308
+ </div><table class="source_code">
1309
+ <tr>
1310
+ <td>
1311
+ <pre class="lines">
1312
+
1313
+
1314
+ 82
1315
+ 83
1316
+ 84
1317
+ 85
1318
+ 86
1319
+ 87</pre>
1320
+ </td>
1321
+ <td>
1322
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 82</span>
1323
+
1324
+ <span class='kw'>def</span> <span class='id identifier rubyid_each_with_index'>each_with_index</span>
1325
+ <span class='id identifier rubyid_ordered_values'>ordered_values</span> <span class='op'>=</span> <span class='id identifier rubyid_values'>values</span>
1326
+ <span class='id identifier rubyid_ordered_values'>ordered_values</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='comma'>,</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
1327
+ <span class='kw'>yield</span> <span class='id identifier rubyid_ordered_values'>ordered_values</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_min_index'>min_index</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='op'>*</span><span class='ivar'>@range</span><span class='rparen'>)</span>
1328
+ <span class='kw'>end</span>
1329
+ <span class='kw'>end</span></pre>
1330
+ </td>
1331
+ </tr>
1332
+ </table>
1333
+ </div>
1334
+
1335
+ <div class="method_details ">
1336
+ <h3 class="signature " id="get-instance_method">
1337
+
1338
+ - (<tt>Object</tt>) <strong>get</strong>(index)
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+ </h3><div class="docstring">
1345
+ <div class="discussion">
1346
+ <p>
1347
+ The value for the specified index
1348
+ </p>
1349
+
1350
+
1351
+ </div>
1352
+ </div>
1353
+ <div class="tags">
1354
+
1355
+ <p class="tag_title">Returns:</p>
1356
+ <ul class="return">
1357
+
1358
+ <li>
1359
+
1360
+
1361
+ <span class='type'>(<tt>Object</tt>)</span>
1362
+
1363
+
1364
+
1365
+ &mdash;
1366
+ <div class='inline'><p>
1367
+ the value for the specified index
1368
+ </p>
1369
+ </div>
1370
+
1371
+ </li>
1372
+
1373
+ </ul>
1374
+
1375
+ </div><table class="source_code">
1376
+ <tr>
1377
+ <td>
1378
+ <pre class="lines">
1379
+
1380
+
1381
+ 90
1382
+ 91
1383
+ 92
1384
+ 93
1385
+ 94</pre>
1386
+ </td>
1387
+ <td>
1388
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 90</span>
1389
+
1390
+ <span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1391
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_in_limits?'>in_limits?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1392
+ <span class='id identifier rubyid_pos'>pos</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='op'>/</span><span class='ivar'>@range</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='ivar'>@size</span><span class='rparen'>)</span>
1393
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='rparen'>)</span>
1394
+ <span class='kw'>end</span></pre>
1395
+ </td>
1396
+ </tr>
1397
+ </table>
1398
+ </div>
1399
+
1400
+ <div class="method_details ">
1401
+ <h3 class="signature " id="higher?-instance_method">
1402
+
1403
+ - (<tt>True</tt>) <strong>higher?</strong>(index)
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+ </h3><div class="docstring">
1410
+ <div class="discussion">
1411
+ <p>
1412
+ If the giving number is higher that the current max index.
1413
+ </p>
1414
+
1415
+
1416
+ </div>
1417
+ </div>
1418
+ <div class="tags">
1419
+ <p class="tag_title">Parameters:</p>
1420
+ <ul class="param">
1421
+
1422
+ <li>
1423
+
1424
+ <span class='name'>index</span>
1425
+
1426
+
1427
+ <span class='type'>(<tt>Integer</tt>)</span>
1428
+
1429
+
1430
+
1431
+ &mdash;
1432
+ <div class='inline'><p>
1433
+ A number
1434
+ </p>
1435
+ </div>
1436
+
1437
+ </li>
1438
+
1439
+ </ul>
1440
+
1441
+ <p class="tag_title">Returns:</p>
1442
+ <ul class="return">
1443
+
1444
+ <li>
1445
+
1446
+
1447
+ <span class='type'>(<tt>True</tt>)</span>
1448
+
1449
+
1450
+
1451
+ &mdash;
1452
+ <div class='inline'><p>
1453
+ if the giving number is higher that the current max index.
1454
+ </p>
1455
+ </div>
1456
+
1457
+ </li>
1458
+
1459
+ </ul>
1460
+
1461
+ </div><table class="source_code">
1462
+ <tr>
1463
+ <td>
1464
+ <pre class="lines">
1465
+
1466
+
1467
+ 66
1468
+ 67
1469
+ 68</pre>
1470
+ </td>
1471
+ <td>
1472
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 66</span>
1473
+
1474
+ <span class='kw'>def</span> <span class='id identifier rubyid_higher?'>higher?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1475
+ <span class='id identifier rubyid_index'>index</span> <span class='op'>&gt;</span> <span class='lparen'>(</span><span class='id identifier rubyid_max_index'>max_index</span> <span class='op'>+</span> <span class='id identifier rubyid_remaining_in_slot'>remaining_in_slot</span><span class='rparen'>)</span>
1476
+ <span class='kw'>end</span></pre>
1477
+ </td>
1478
+ </tr>
1479
+ </table>
1480
+ </div>
1481
+
1482
+ <div class="method_details ">
1483
+ <h3 class="signature " id="in_limits?-instance_method">
1484
+
1485
+ - (<tt>True</tt>) <strong>in_limits?</strong>(index)
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+ </h3><div class="docstring">
1492
+ <div class="discussion">
1493
+ <p>
1494
+ If the given number is in the limits of the current max an min index of the
1495
+ list
1496
+ </p>
1497
+
1498
+
1499
+ </div>
1500
+ </div>
1501
+ <div class="tags">
1502
+ <p class="tag_title">Parameters:</p>
1503
+ <ul class="param">
1504
+
1505
+ <li>
1506
+
1507
+ <span class='name'>index</span>
1508
+
1509
+
1510
+ <span class='type'>(<tt>Integer</tt>)</span>
1511
+
1512
+
1513
+
1514
+ &mdash;
1515
+ <div class='inline'><p>
1516
+ A number
1517
+ </p>
1518
+ </div>
1519
+
1520
+ </li>
1521
+
1522
+ </ul>
1523
+
1524
+ <p class="tag_title">Returns:</p>
1525
+ <ul class="return">
1526
+
1527
+ <li>
1528
+
1529
+
1530
+ <span class='type'>(<tt>True</tt>)</span>
1531
+
1532
+
1533
+
1534
+ &mdash;
1535
+ <div class='inline'><p>
1536
+ if the given number is in the limits of the current max an min index of the
1537
+ list
1538
+ </p>
1539
+ </div>
1540
+
1541
+ </li>
1542
+
1543
+ </ul>
1544
+
1545
+ </div><table class="source_code">
1546
+ <tr>
1547
+ <td>
1548
+ <pre class="lines">
1549
+
1550
+
1551
+ 48
1552
+ 49
1553
+ 50</pre>
1554
+ </td>
1555
+ <td>
1556
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 48</span>
1557
+
1558
+ <span class='kw'>def</span> <span class='id identifier rubyid_in_limits?'>in_limits?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1559
+ <span class='lparen'>(</span> <span class='op'>!</span><span class='id identifier rubyid_higher?'>higher?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_lower?'>lower?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span><span class='rparen'>)</span>
1560
+ <span class='kw'>end</span></pre>
1561
+ </td>
1562
+ </tr>
1563
+ </table>
1564
+ </div>
1565
+
1566
+ <div class="method_details ">
1567
+ <h3 class="signature " id="index_size-instance_method">
1568
+
1569
+ - (<tt>Integer</tt>) <strong>index_size</strong>
1570
+
1571
+
1572
+
1573
+
1574
+
1575
+ </h3><div class="docstring">
1576
+ <div class="discussion">
1577
+ <p>
1578
+ The index size of this list
1579
+ </p>
1580
+
1581
+
1582
+ </div>
1583
+ </div>
1584
+ <div class="tags">
1585
+
1586
+ <p class="tag_title">Returns:</p>
1587
+ <ul class="return">
1588
+
1589
+ <li>
1590
+
1591
+
1592
+ <span class='type'>(<tt>Integer</tt>)</span>
1593
+
1594
+
1595
+
1596
+ &mdash;
1597
+ <div class='inline'><p>
1598
+ the index size of this list
1599
+ </p>
1600
+ </div>
1601
+
1602
+ </li>
1603
+
1604
+ </ul>
1605
+
1606
+ </div><table class="source_code">
1607
+ <tr>
1608
+ <td>
1609
+ <pre class="lines">
1610
+
1611
+
1612
+ 140
1613
+ 141
1614
+ 142</pre>
1615
+ </td>
1616
+ <td>
1617
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 140</span>
1618
+
1619
+ <span class='kw'>def</span> <span class='id identifier rubyid_index_size'>index_size</span>
1620
+ <span class='ivar'>@size</span><span class='op'>*</span><span class='ivar'>@range</span>
1621
+ <span class='kw'>end</span></pre>
1622
+ </td>
1623
+ </tr>
1624
+ </table>
1625
+ </div>
1626
+
1627
+ <div class="method_details ">
1628
+ <h3 class="signature " id="lower?-instance_method">
1629
+
1630
+ - (<tt>True</tt>) <strong>lower?</strong>(index)
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+ </h3><div class="docstring">
1637
+ <div class="discussion">
1638
+ <p>
1639
+ If the giving number is lower that the current min index.
1640
+ </p>
1641
+
1642
+
1643
+ </div>
1644
+ </div>
1645
+ <div class="tags">
1646
+ <p class="tag_title">Parameters:</p>
1647
+ <ul class="param">
1648
+
1649
+ <li>
1650
+
1651
+ <span class='name'>index</span>
1652
+
1653
+
1654
+ <span class='type'>(<tt>Integer</tt>)</span>
1655
+
1656
+
1657
+
1658
+ &mdash;
1659
+ <div class='inline'><p>
1660
+ A number
1661
+ </p>
1662
+ </div>
1663
+
1664
+ </li>
1665
+
1666
+ </ul>
1667
+
1668
+ <p class="tag_title">Returns:</p>
1669
+ <ul class="return">
1670
+
1671
+ <li>
1672
+
1673
+
1674
+ <span class='type'>(<tt>True</tt>)</span>
1675
+
1676
+
1677
+
1678
+ &mdash;
1679
+ <div class='inline'><p>
1680
+ if the giving number is lower that the current min index.
1681
+ </p>
1682
+ </div>
1683
+
1684
+ </li>
1685
+
1686
+ </ul>
1687
+
1688
+ </div><table class="source_code">
1689
+ <tr>
1690
+ <td>
1691
+ <pre class="lines">
1692
+
1693
+
1694
+ 72
1695
+ 73
1696
+ 74</pre>
1697
+ </td>
1698
+ <td>
1699
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 72</span>
1700
+
1701
+ <span class='kw'>def</span> <span class='id identifier rubyid_lower?'>lower?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1702
+ <span class='id identifier rubyid_index'>index</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_min_index'>min_index</span>
1703
+ <span class='kw'>end</span></pre>
1704
+ </td>
1705
+ </tr>
1706
+ </table>
1707
+ </div>
1708
+
1709
+ <div class="method_details ">
1710
+ <h3 class="signature " id="max_index-instance_method">
1711
+
1712
+ - (<tt>Integer</tt>) <strong>max_index</strong>
1713
+
1714
+
1715
+
1716
+
1717
+
1718
+ </h3><div class="docstring">
1719
+ <div class="discussion">
1720
+ <p>
1721
+ The max indes of current list
1722
+ </p>
1723
+
1724
+
1725
+ </div>
1726
+ </div>
1727
+ <div class="tags">
1728
+
1729
+ <p class="tag_title">Returns:</p>
1730
+ <ul class="return">
1731
+
1732
+ <li>
1733
+
1734
+
1735
+ <span class='type'>(<tt>Integer</tt>)</span>
1736
+
1737
+
1738
+
1739
+ &mdash;
1740
+ <div class='inline'><p>
1741
+ the max indes of current list
1742
+ </p>
1743
+ </div>
1744
+
1745
+ </li>
1746
+
1747
+ </ul>
1748
+
1749
+ </div><table class="source_code">
1750
+ <tr>
1751
+ <td>
1752
+ <pre class="lines">
1753
+
1754
+
1755
+ 154
1756
+ 155
1757
+ 156</pre>
1758
+ </td>
1759
+ <td>
1760
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 154</span>
1761
+
1762
+ <span class='kw'>def</span> <span class='id identifier rubyid_max_index'>max_index</span>
1763
+ <span class='ivar'>@current_index</span>
1764
+ <span class='kw'>end</span></pre>
1765
+ </td>
1766
+ </tr>
1767
+ </table>
1768
+ </div>
1769
+
1770
+ <div class="method_details ">
1771
+ <h3 class="signature " id="min_index-instance_method">
1772
+
1773
+ - (<tt>Integer</tt>) <strong>min_index</strong>
1774
+
1775
+
1776
+
1777
+
1778
+
1779
+ </h3><div class="docstring">
1780
+ <div class="discussion">
1781
+ <p>
1782
+ The min index of the current list
1783
+ </p>
1784
+
1785
+
1786
+ </div>
1787
+ </div>
1788
+ <div class="tags">
1789
+
1790
+ <p class="tag_title">Returns:</p>
1791
+ <ul class="return">
1792
+
1793
+ <li>
1794
+
1795
+
1796
+ <span class='type'>(<tt>Integer</tt>)</span>
1797
+
1798
+
1799
+
1800
+ &mdash;
1801
+ <div class='inline'><p>
1802
+ The min index of the current list
1803
+ </p>
1804
+ </div>
1805
+
1806
+ </li>
1807
+
1808
+ </ul>
1809
+
1810
+ </div><table class="source_code">
1811
+ <tr>
1812
+ <td>
1813
+ <pre class="lines">
1814
+
1815
+
1816
+ 145
1817
+ 146
1818
+ 147
1819
+ 148
1820
+ 149
1821
+ 150
1822
+ 151</pre>
1823
+ </td>
1824
+ <td>
1825
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 145</span>
1826
+
1827
+ <span class='kw'>def</span> <span class='id identifier rubyid_min_index'>min_index</span>
1828
+ <span class='kw'>if</span> <span class='id identifier rubyid_max_index'>max_index</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_index_size'>index_size</span>
1829
+ <span class='int'>0</span>
1830
+ <span class='kw'>else</span>
1831
+ <span class='lparen'>(</span><span class='id identifier rubyid_max_index'>max_index</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_index_size'>index_size</span> <span class='op'>+</span> <span class='id identifier rubyid_remaining_in_slot'>remaining_in_slot</span>
1832
+ <span class='kw'>end</span>
1833
+ <span class='kw'>end</span></pre>
1834
+ </td>
1835
+ </tr>
1836
+ </table>
1837
+ </div>
1838
+
1839
+ <div class="method_details ">
1840
+ <h3 class="signature " id="out_of_range?-instance_method">
1841
+
1842
+ - (<tt>True</tt>) <strong>out_of_range?</strong>(index)
1843
+
1844
+
1845
+
1846
+
1847
+
1848
+ </h3><div class="docstring">
1849
+ <div class="discussion">
1850
+ <p>
1851
+ If the given number is out of the range and all numbers will be lost if set
1852
+ </p>
1853
+
1854
+
1855
+ </div>
1856
+ </div>
1857
+ <div class="tags">
1858
+ <p class="tag_title">Parameters:</p>
1859
+ <ul class="param">
1860
+
1861
+ <li>
1862
+
1863
+ <span class='name'>index</span>
1864
+
1865
+
1866
+ <span class='type'>(<tt>Integer</tt>)</span>
1867
+
1868
+
1869
+
1870
+ &mdash;
1871
+ <div class='inline'><p>
1872
+ A number
1873
+ </p>
1874
+ </div>
1875
+
1876
+ </li>
1877
+
1878
+ </ul>
1879
+
1880
+ <p class="tag_title">Returns:</p>
1881
+ <ul class="return">
1882
+
1883
+ <li>
1884
+
1885
+
1886
+ <span class='type'>(<tt>True</tt>)</span>
1887
+
1888
+
1889
+
1890
+ &mdash;
1891
+ <div class='inline'><p>
1892
+ if the given number is out of the range and all numbers will be lost if set
1893
+ </p>
1894
+ </div>
1895
+
1896
+ </li>
1897
+
1898
+ </ul>
1899
+
1900
+ </div><table class="source_code">
1901
+ <tr>
1902
+ <td>
1903
+ <pre class="lines">
1904
+
1905
+
1906
+ 54
1907
+ 55
1908
+ 56
1909
+ 57
1910
+ 58
1911
+ 59
1912
+ 60
1913
+ 61
1914
+ 62</pre>
1915
+ </td>
1916
+ <td>
1917
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 54</span>
1918
+
1919
+ <span class='kw'>def</span> <span class='id identifier rubyid_out_of_range?'>out_of_range?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span> <span class='comment'># refactor to out of limits?
1920
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_in_limits?'>in_limits?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1921
+ <span class='kw'>return</span> <span class='kw'>false</span>
1922
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_higher?'>higher?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1923
+ <span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span> <span class='op'>-</span> <span class='id identifier rubyid_max_index'>max_index</span><span class='rparen'>)</span> <span class='op'>&gt;=</span> <span class='lparen'>(</span><span class='ivar'>@size</span><span class='op'>*</span><span class='ivar'>@range</span><span class='rparen'>)</span>
1924
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_lower?'>lower?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
1925
+ <span class='lparen'>(</span><span class='id identifier rubyid_min_index'>min_index</span> <span class='op'>-</span> <span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span> <span class='op'>&gt;=</span> <span class='lparen'>(</span><span class='ivar'>@size</span><span class='op'>*</span><span class='ivar'>@range</span><span class='rparen'>)</span>
1926
+ <span class='kw'>end</span>
1927
+ <span class='kw'>end</span></pre>
1928
+ </td>
1929
+ </tr>
1930
+ </table>
1931
+ </div>
1932
+
1933
+ <div class="method_details ">
1934
+ <h3 class="signature " id="ranges-instance_method">
1935
+
1936
+ - (<tt>Array&lt;Integer&gt;</tt>) <strong>ranges</strong>
1937
+
1938
+
1939
+
1940
+
1941
+
1942
+ </h3><div class="docstring">
1943
+ <div class="discussion">
1944
+ <p>
1945
+ The min_index and max_index as a list
1946
+ </p>
1947
+
1948
+
1949
+ </div>
1950
+ </div>
1951
+ <div class="tags">
1952
+
1953
+ <p class="tag_title">Returns:</p>
1954
+ <ul class="return">
1955
+
1956
+ <li>
1957
+
1958
+
1959
+ <span class='type'>(<tt>Array&lt;Integer&gt;</tt>)</span>
1960
+
1961
+
1962
+
1963
+ &mdash;
1964
+ <div class='inline'><p>
1965
+ The min_index and max_index as a list
1966
+ </p>
1967
+ </div>
1968
+
1969
+ </li>
1970
+
1971
+ </ul>
1972
+
1973
+ </div><table class="source_code">
1974
+ <tr>
1975
+ <td>
1976
+ <pre class="lines">
1977
+
1978
+
1979
+ 42
1980
+ 43
1981
+ 44</pre>
1982
+ </td>
1983
+ <td>
1984
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 42</span>
1985
+
1986
+ <span class='kw'>def</span> <span class='id identifier rubyid_ranges'>ranges</span>
1987
+ <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_min_index'>min_index</span><span class='comma'>,</span><span class='id identifier rubyid_max_index'>max_index</span><span class='rbracket'>]</span>
1988
+ <span class='kw'>end</span></pre>
1989
+ </td>
1990
+ </tr>
1991
+ </table>
1992
+ </div>
1993
+
1994
+ <div class="method_details ">
1995
+ <h3 class="signature " id="remaining_in_slot-instance_method">
1996
+
1997
+ - (<tt>Integer</tt>) <strong>remaining_in_slot</strong>
1998
+
1999
+
2000
+
2001
+
2002
+
2003
+ </h3><div class="docstring">
2004
+ <div class="discussion">
2005
+ <p>
2006
+ If range is used, returns the remaining numbers in the current position.
2007
+ </p>
2008
+
2009
+
2010
+ </div>
2011
+ </div>
2012
+ <div class="tags">
2013
+
2014
+ <p class="tag_title">Returns:</p>
2015
+ <ul class="return">
2016
+
2017
+ <li>
2018
+
2019
+
2020
+ <span class='type'>(<tt>Integer</tt>)</span>
2021
+
2022
+
2023
+
2024
+ &mdash;
2025
+ <div class='inline'><p>
2026
+ if range is used, returns the remaining numbers in the current position.
2027
+ </p>
2028
+ </div>
2029
+
2030
+ </li>
2031
+
2032
+ </ul>
2033
+
2034
+ </div><table class="source_code">
2035
+ <tr>
2036
+ <td>
2037
+ <pre class="lines">
2038
+
2039
+
2040
+ 135
2041
+ 136
2042
+ 137</pre>
2043
+ </td>
2044
+ <td>
2045
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 135</span>
2046
+
2047
+ <span class='kw'>def</span> <span class='id identifier rubyid_remaining_in_slot'>remaining_in_slot</span>
2048
+ <span class='lparen'>(</span><span class='ivar'>@range</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id identifier rubyid_max_index'>max_index</span> <span class='op'>%</span> <span class='ivar'>@range</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='int'>1</span>
2049
+ <span class='kw'>end</span></pre>
2050
+ </td>
2051
+ </tr>
2052
+ </table>
2053
+ </div>
2054
+
2055
+ <div class="method_details ">
2056
+ <h3 class="signature " id="reset-instance_method">
2057
+
2058
+ - (<tt>Object</tt>) <strong>reset</strong>
2059
+
2060
+
2061
+
2062
+
2063
+
2064
+ </h3><div class="docstring">
2065
+ <div class="discussion">
2066
+ <p>
2067
+ Reset this list, set all values to nil and move cursor to position 0
2068
+ </p>
2069
+
2070
+
2071
+ </div>
2072
+ </div>
2073
+ <div class="tags">
2074
+
2075
+
2076
+ </div><table class="source_code">
2077
+ <tr>
2078
+ <td>
2079
+ <pre class="lines">
2080
+
2081
+
2082
+ 35
2083
+ 36
2084
+ 37
2085
+ 38
2086
+ 39</pre>
2087
+ </td>
2088
+ <td>
2089
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 35</span>
2090
+
2091
+ <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
2092
+ <span class='id identifier rubyid_clear'>clear</span>
2093
+ <span class='ivar'>@position</span> <span class='op'>=</span> <span class='int'>0</span>
2094
+ <span class='ivar'>@current_index</span> <span class='op'>=</span> <span class='int'>0</span>
2095
+ <span class='kw'>end</span></pre>
2096
+ </td>
2097
+ </tr>
2098
+ </table>
2099
+ </div>
2100
+
2101
+ <div class="method_details ">
2102
+ <h3 class="signature " id="set_at-instance_method">
2103
+
2104
+ - (<tt>Object</tt>) <strong>set_at</strong>(index, value)
2105
+
2106
+
2107
+
2108
+
2109
+
2110
+ </h3><div class="docstring">
2111
+ <div class="discussion">
2112
+ <p>
2113
+ Set the specified value in the given index. The index must be in the range.
2114
+ </p>
2115
+
2116
+
2117
+ </div>
2118
+ </div>
2119
+ <div class="tags">
2120
+
2121
+
2122
+ </div><table class="source_code">
2123
+ <tr>
2124
+ <td>
2125
+ <pre class="lines">
2126
+
2127
+
2128
+ 126
2129
+ 127
2130
+ 128
2131
+ 129
2132
+ 130
2133
+ 131
2134
+ 132</pre>
2135
+ </td>
2136
+ <td>
2137
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 126</span>
2138
+
2139
+ <span class='kw'>def</span> <span class='id identifier rubyid_set_at'>set_at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
2140
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The index </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='rbrace'>}</span><span class='tstring_content'> is not in the range of the list</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_in_limits?'>in_limits?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
2141
+
2142
+ <span class='id identifier rubyid_pos'>pos</span> <span class='op'>=</span> <span class='id identifier rubyid_position_for_index'>position_for_index</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
2143
+
2144
+ <span class='id identifier rubyid_set_value'>set_value</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
2145
+ <span class='kw'>end</span></pre>
2146
+ </td>
2147
+ </tr>
2148
+ </table>
2149
+ </div>
2150
+
2151
+ <div class="method_details ">
2152
+ <h3 class="signature " id="to_s-instance_method">
2153
+
2154
+ - (<tt>Object</tt>) <strong>to_s</strong>
2155
+
2156
+
2157
+
2158
+
2159
+
2160
+ </h3><div class="docstring">
2161
+ <div class="discussion">
2162
+ <p>
2163
+ Pretty print this object
2164
+ </p>
2165
+
2166
+
2167
+ </div>
2168
+ </div>
2169
+ <div class="tags">
2170
+
2171
+
2172
+ </div><table class="source_code">
2173
+ <tr>
2174
+ <td>
2175
+ <pre class="lines">
2176
+
2177
+
2178
+ 170
2179
+ 171
2180
+ 172</pre>
2181
+ </td>
2182
+ <td>
2183
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 170</span>
2184
+
2185
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
2186
+ <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
2187
+ <span class='kw'>end</span></pre>
2188
+ </td>
2189
+ </tr>
2190
+ </table>
2191
+ </div>
2192
+
2193
+ <div class="method_details ">
2194
+ <h3 class="signature " id="values-instance_method">
2195
+
2196
+ - (<tt>Array&lt;Object&gt;</tt>) <strong>values</strong>
2197
+
2198
+
2199
+
2200
+
2201
+
2202
+ </h3><div class="docstring">
2203
+ <div class="discussion">
2204
+ <p>
2205
+ The values of this list
2206
+ </p>
2207
+
2208
+
2209
+ </div>
2210
+ </div>
2211
+ <div class="tags">
2212
+
2213
+ <p class="tag_title">Returns:</p>
2214
+ <ul class="return">
2215
+
2216
+ <li>
2217
+
2218
+
2219
+ <span class='type'>(<tt>Array&lt;Object&gt;</tt>)</span>
2220
+
2221
+
2222
+
2223
+ &mdash;
2224
+ <div class='inline'><p>
2225
+ The values of this list
2226
+ </p>
2227
+ </div>
2228
+
2229
+ </li>
2230
+
2231
+ </ul>
2232
+
2233
+ </div><table class="source_code">
2234
+ <tr>
2235
+ <td>
2236
+ <pre class="lines">
2237
+
2238
+
2239
+ 159
2240
+ 160
2241
+ 161
2242
+ 162
2243
+ 163
2244
+ 164
2245
+ 165
2246
+ 166
2247
+ 167</pre>
2248
+ </td>
2249
+ <td>
2250
+ <pre class="code"><span class="info file"># File 'lib/rrlist/list.rb', line 159</span>
2251
+
2252
+ <span class='kw'>def</span> <span class='id identifier rubyid_values'>values</span>
2253
+ <span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='ivar'>@current_index</span> <span class='op'>&lt;</span> <span class='lparen'>(</span><span class='ivar'>@size</span><span class='op'>*</span><span class='ivar'>@range</span><span class='rparen'>)</span>
2254
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_raw'>raw</span>
2255
+ <span class='kw'>else</span>
2256
+ <span class='ivar'>@store</span><span class='period'>.</span><span class='id identifier rubyid_start_at'>start_at</span><span class='lparen'>(</span><span class='ivar'>@position</span><span class='rparen'>)</span>
2257
+ <span class='kw'>end</span>
2258
+
2259
+ <span class='kw'>return</span> <span class='id identifier rubyid_ret'>ret</span>
2260
+ <span class='kw'>end</span></pre>
2261
+ </td>
2262
+ </tr>
2263
+ </table>
2264
+ </div>
2265
+
2266
+ </div>
2267
+
2268
+ </div>
2269
+
2270
+ <div id="footer">
2271
+ Generated on Fri May 31 08:53:02 2013 by
2272
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2273
+ 0.8.6.1 (ruby-1.9.2).
2274
+ </div>
2275
+
2276
+ </body>
2277
+ </html>