dbmlite3 2.0.0.pre.alpha.3 → 2.0.0.pre.alpha.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2560 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Lite3::DBM
8
+
9
+ &mdash; Documentation by YARD 0.9.26
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Lite3::DBM";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (D)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Lite3.html" title="Lite3 (module)">Lite3</a></span></span>
41
+ &raquo;
42
+ <span class="title">DBM</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Lite3::DBM
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Lite3::DBM</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
92
+ <dd>Enumerable</dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/internal_lite3/dbm.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Lite3::DBM encapsulates a single table in a single SQLite3 database file and lets you access it as easily as a Hash. Multiple instances may be opened on different tables in the same database.</p>
111
+
112
+ <p>Note that instances do not explicitly own their database connection; instead, they are managed internally and shared across <code>DBM</code> instances.</p>
113
+
114
+
115
+ </div>
116
+ </div>
117
+ <div class="tags">
118
+
119
+
120
+ </div>
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <h2>
129
+ Class Method Summary
130
+ <small><a href="#" class="summary_toggle">collapse</a></small>
131
+ </h2>
132
+
133
+ <ul class="summary">
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#open-class_method" title="open (class method)">.<strong>open</strong>(filename, tablename, serializer = :yaml, &amp;block) &#x21d2; Object </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>Identical to <code>initialize</code> except that if a block is provided, it is evaluated with a new Lite3::DBM which is then closed afterward.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ </ul>
160
+
161
+ <h2>
162
+ Instance Method Summary
163
+ <small><a href="#" class="summary_toggle">collapse</a></small>
164
+ </h2>
165
+
166
+ <ul class="summary">
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(key) &#x21d2; Object </a>
172
+
173
+
174
+
175
+ </span>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <span class="summary_desc"><div class='inline'>
186
+ <p>Retrieve the value associated with <code>key</code> from the database or nil if it is not present.</p>
187
+ </div></span>
188
+
189
+ </li>
190
+
191
+
192
+ <li class="public ">
193
+ <span class="summary_signature">
194
+
195
+ <a href="#[]=-instance_method" title="#[]= (instance method)">#<strong>[]=</strong>(key, value) &#x21d2; Object </a>
196
+
197
+
198
+
199
+ (also: #store)
200
+
201
+ </span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'>
212
+ <p>Store <code>value</code> at <code>key</code> in the database.</p>
213
+ </div></span>
214
+
215
+ </li>
216
+
217
+
218
+ <li class="public ">
219
+ <span class="summary_signature">
220
+
221
+ <a href="#clear-instance_method" title="#clear (instance method)">#<strong>clear</strong> &#x21d2; Object </a>
222
+
223
+
224
+
225
+ </span>
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ <span class="summary_desc"><div class='inline'>
236
+ <p>Delete all entries from the table.</p>
237
+ </div></span>
238
+
239
+ </li>
240
+
241
+
242
+ <li class="public ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> &#x21d2; Object </a>
246
+
247
+
248
+
249
+ </span>
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'>
260
+ <p>Disassociate <code>self</code> from the underlying database.</p>
261
+ </div></span>
262
+
263
+ </li>
264
+
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#closed%3F-instance_method" title="#closed? (instance method)">#<strong>closed?</strong> &#x21d2; Boolean </a>
270
+
271
+
272
+
273
+ </span>
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ <span class="summary_desc"><div class='inline'>
284
+ <p>Test if this object has been closed.</p>
285
+ </div></span>
286
+
287
+ </li>
288
+
289
+
290
+ <li class="public ">
291
+ <span class="summary_signature">
292
+
293
+ <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong>(key) &#x21d2; Object </a>
294
+
295
+
296
+
297
+ </span>
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+ <span class="summary_desc"><div class='inline'>
308
+ <p>Remove <code>key</code> and its associated value from <code>self</code>.</p>
309
+ </div></span>
310
+
311
+ </li>
312
+
313
+
314
+ <li class="public ">
315
+ <span class="summary_signature">
316
+
317
+ <a href="#delete_if-instance_method" title="#delete_if (instance method)">#<strong>delete_if</strong> {|value| ... } &#x21d2; Object </a>
318
+
319
+
320
+
321
+ (also: #reject!)
322
+
323
+ </span>
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ <span class="summary_desc"><div class='inline'>
334
+ <p>Evaluate the block on each key-value pair in <code>self</code> end delete each entry for which the block returns true.</p>
335
+ </div></span>
336
+
337
+ </li>
338
+
339
+
340
+ <li class="public ">
341
+ <span class="summary_signature">
342
+
343
+ <a href="#each-instance_method" title="#each (instance method)">#<strong>each</strong> {|key, value| ... } &#x21d2; Object </a>
344
+
345
+
346
+
347
+ (also: #each_pair)
348
+
349
+ </span>
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+ <span class="summary_desc"><div class='inline'>
360
+ <p>Calls the given block with each key-value pair in the usual order, then return self.</p>
361
+ </div></span>
362
+
363
+ </li>
364
+
365
+
366
+ <li class="public ">
367
+ <span class="summary_signature">
368
+
369
+ <a href="#each_key-instance_method" title="#each_key (instance method)">#<strong>each_key</strong> {|key| ... } &#x21d2; Object </a>
370
+
371
+
372
+
373
+ </span>
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ <span class="summary_desc"><div class='inline'>
384
+ <p>Calls the given block with each key; returns self.</p>
385
+ </div></span>
386
+
387
+ </li>
388
+
389
+
390
+ <li class="public ">
391
+ <span class="summary_signature">
392
+
393
+ <a href="#each_value-instance_method" title="#each_value (instance method)">#<strong>each_value</strong> {|value| ... } &#x21d2; Object </a>
394
+
395
+
396
+
397
+ </span>
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+ <span class="summary_desc"><div class='inline'>
408
+ <p>Calls the given block with each value; returns self.</p>
409
+ </div></span>
410
+
411
+ </li>
412
+
413
+
414
+ <li class="public ">
415
+ <span class="summary_signature">
416
+
417
+ <a href="#empty%3F-instance_method" title="#empty? (instance method)">#<strong>empty?</strong> &#x21d2; Boolean </a>
418
+
419
+
420
+
421
+ </span>
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+ <span class="summary_desc"><div class='inline'>
432
+ <p>Test if <code>self</code> is empty.</p>
433
+ </div></span>
434
+
435
+ </li>
436
+
437
+
438
+ <li class="public ">
439
+ <span class="summary_signature">
440
+
441
+ <a href="#fast_each-instance_method" title="#fast_each (instance method)">#<strong>fast_each</strong> {|key, value| ... } &#x21d2; Object </a>
442
+
443
+
444
+
445
+ </span>
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+ <span class="summary_desc"><div class='inline'>
456
+ <p>Behaves like &#39;each&#39; with a block–that is, call it for each key/value pair–but (probably) executes faster.</p>
457
+ </div></span>
458
+
459
+ </li>
460
+
461
+
462
+ <li class="public ">
463
+ <span class="summary_signature">
464
+
465
+ <a href="#fetch-instance_method" title="#fetch (instance method)">#<strong>fetch</strong>(key, *args) {|key| ... } &#x21d2; Object </a>
466
+
467
+
468
+
469
+ </span>
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+ <span class="summary_desc"><div class='inline'>
480
+ <p>Retrieve the value associated with <code>key</code>.</p>
481
+ </div></span>
482
+
483
+ </li>
484
+
485
+
486
+ <li class="public ">
487
+ <span class="summary_signature">
488
+
489
+ <a href="#has_key%3F-instance_method" title="#has_key? (instance method)">#<strong>has_key?</strong>(key) &#x21d2; Boolean </a>
490
+
491
+
492
+
493
+ (also: #include?, #member?, #key?)
494
+
495
+ </span>
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+ <span class="summary_desc"><div class='inline'>
506
+ <p>Return <code>true</code> if the table contains <code>key</code>; otherwise, return <code>false</code>.</p>
507
+ </div></span>
508
+
509
+ </li>
510
+
511
+
512
+ <li class="public ">
513
+ <span class="summary_signature">
514
+
515
+ <a href="#has_value%3F-instance_method" title="#has_value? (instance method)">#<strong>has_value?</strong>(val) &#x21d2; Boolean </a>
516
+
517
+
518
+
519
+ (also: #value?)
520
+
521
+ </span>
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+ <span class="summary_desc"><div class='inline'>
532
+ <p>Test if <code>val</code> is one of the values in this table.</p>
533
+ </div></span>
534
+
535
+ </li>
536
+
537
+
538
+ <li class="public ">
539
+ <span class="summary_signature">
540
+
541
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(filename, tablename, serializer = :yaml) &#x21d2; DBM </a>
542
+
543
+
544
+
545
+ </span>
546
+
547
+
548
+ <span class="note title constructor">constructor</span>
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+ <span class="summary_desc"><div class='inline'>
558
+ <p>Create a new <code>Lite3::DBM</code> object that opens database file <code>filename</code> and performs subsequent operations on <code>table</code>.</p>
559
+ </div></span>
560
+
561
+ </li>
562
+
563
+
564
+ <li class="public ">
565
+ <span class="summary_signature">
566
+
567
+ <a href="#invert-instance_method" title="#invert (instance method)">#<strong>invert</strong> &#x21d2; Object </a>
568
+
569
+
570
+
571
+ </span>
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+ <span class="summary_desc"><div class='inline'>
582
+ <p>Return a <code>Hash</code> whose keys are the table&#39;s values and whose values are the table&#39;s keys.</p>
583
+ </div></span>
584
+
585
+ </li>
586
+
587
+
588
+ <li class="public ">
589
+ <span class="summary_signature">
590
+
591
+ <a href="#keys-instance_method" title="#keys (instance method)">#<strong>keys</strong> &#x21d2; Object </a>
592
+
593
+
594
+
595
+ </span>
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+ <span class="summary_desc"><div class='inline'>
606
+ <p>Return an <code>Array</code> of all of the keys in the table.</p>
607
+ </div></span>
608
+
609
+ </li>
610
+
611
+
612
+ <li class="public ">
613
+ <span class="summary_signature">
614
+
615
+ <a href="#shift-instance_method" title="#shift (instance method)">#<strong>shift</strong> &#x21d2; Object </a>
616
+
617
+
618
+
619
+ </span>
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+ <span class="summary_desc"><div class='inline'>
630
+ <p>Remove the first key/value pair from <code>self</code> and return it.</p>
631
+ </div></span>
632
+
633
+ </li>
634
+
635
+
636
+ <li class="public ">
637
+ <span class="summary_signature">
638
+
639
+ <a href="#size-instance_method" title="#size (instance method)">#<strong>size</strong> &#x21d2; Object </a>
640
+
641
+
642
+
643
+ (also: #length)
644
+
645
+ </span>
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+ <span class="summary_desc"><div class='inline'>
656
+ <p>Return the number of entries (key-value pairs) in <code>self</code>.</p>
657
+ </div></span>
658
+
659
+ </li>
660
+
661
+
662
+ <li class="public ">
663
+ <span class="summary_signature">
664
+
665
+ <a href="#to_a-instance_method" title="#to_a (instance method)">#<strong>to_a</strong> &#x21d2; Object </a>
666
+
667
+
668
+
669
+ </span>
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+ <span class="summary_desc"><div class='inline'>
680
+ <p>Returns an <code>Array</code> of 2-element <code>Array</code> objects each containing a key-value pair from <code>self</code>.</p>
681
+ </div></span>
682
+
683
+ </li>
684
+
685
+
686
+ <li class="public ">
687
+ <span class="summary_signature">
688
+
689
+ <a href="#to_hash-instance_method" title="#to_hash (instance method)">#<strong>to_hash</strong> &#x21d2; Object </a>
690
+
691
+
692
+
693
+ </span>
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+ <span class="summary_desc"><div class='inline'>
704
+ <p>Copies the table into a <code>Hash</code> and returns it.</p>
705
+ </div></span>
706
+
707
+ </li>
708
+
709
+
710
+ <li class="public ">
711
+ <span class="summary_signature">
712
+
713
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
714
+
715
+
716
+
717
+ (also: #inspect)
718
+
719
+ </span>
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+ <span class="summary_desc"><div class='inline'></div></span>
730
+
731
+ </li>
732
+
733
+
734
+ <li class="public ">
735
+ <span class="summary_signature">
736
+
737
+ <a href="#transaction-instance_method" title="#transaction (instance method)">#<strong>transaction</strong> {|db| ... } &#x21d2; obj </a>
738
+
739
+
740
+
741
+ </span>
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+ <span class="summary_desc"><div class='inline'>
752
+ <p>Begins a transaction, evaluates the given block and then ends the transaction.</p>
753
+ </div></span>
754
+
755
+ </li>
756
+
757
+
758
+ <li class="public ">
759
+ <span class="summary_signature">
760
+
761
+ <a href="#transaction_active%3F-instance_method" title="#transaction_active? (instance method)">#<strong>transaction_active?</strong> &#x21d2; Boolean </a>
762
+
763
+
764
+
765
+ </span>
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+ <span class="summary_desc"><div class='inline'>
776
+ <p>Test if there is currently a transaction in progress.</p>
777
+ </div></span>
778
+
779
+ </li>
780
+
781
+
782
+ <li class="public ">
783
+ <span class="summary_signature">
784
+
785
+ <a href="#update-instance_method" title="#update (instance method)">#<strong>update</strong>(hash) &#x21d2; Object </a>
786
+
787
+
788
+
789
+ </span>
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+ <span class="summary_desc"><div class='inline'>
800
+ <p>Updates the database with multiple values from the specified object.</p>
801
+ </div></span>
802
+
803
+ </li>
804
+
805
+
806
+ <li class="public ">
807
+ <span class="summary_signature">
808
+
809
+ <a href="#values-instance_method" title="#values (instance method)">#<strong>values</strong> &#x21d2; Object </a>
810
+
811
+
812
+
813
+ </span>
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+ <span class="summary_desc"><div class='inline'>
824
+ <p>Return an array of all values in the table.</p>
825
+ </div></span>
826
+
827
+ </li>
828
+
829
+
830
+ <li class="public ">
831
+ <span class="summary_signature">
832
+
833
+ <a href="#values_at-instance_method" title="#values_at (instance method)">#<strong>values_at</strong>(*keys) &#x21d2; Object </a>
834
+
835
+
836
+
837
+ </span>
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+ <span class="summary_desc"><div class='inline'>
848
+ <p>Return a new <code>Array</code> containing the values corresponding to the given keys.</p>
849
+ </div></span>
850
+
851
+ </li>
852
+
853
+
854
+ </ul>
855
+
856
+
857
+
858
+
859
+
860
+
861
+
862
+
863
+
864
+ <div id="constructor_details" class="method_details_list">
865
+ <h2>Constructor Details</h2>
866
+
867
+ <div class="method_details first">
868
+ <h3 class="signature first" id="initialize-instance_method">
869
+
870
+ #<strong>initialize</strong>(filename, tablename, serializer = :yaml) &#x21d2; <tt><span class='object_link'><a href="" title="Lite3::DBM (class)">DBM</a></span></tt>
871
+
872
+
873
+
874
+
875
+
876
+ </h3><div class="docstring">
877
+ <div class="discussion">
878
+
879
+ <p>Create a new <code>Lite3::DBM</code> object that opens database file <code>filename</code> and performs subsequent operations on <code>table</code>. Both the database file and the table will be created if they do not yet exist. The table name must be a valid name identifier (i.e. matches <code>/^[a-zA-Z_]\w*$/</code>).</p>
880
+
881
+ <p>The optional third argument <code>serializer</code> is used to choose the serialization method for converting Ruby values into storable strings. There are three options:</p>
882
+ <ul><li>
883
+ <p><code>:yaml</code> uses the <code>Psych</code> module.</p>
884
+ </li><li>
885
+ <p><code>:marshal</code> uses the <code>Marshal</code> module.</p>
886
+ </li><li>
887
+ <p><code>:string</code> simply uses the default <code>to_s</code> method, just like the stock <code>DBM</code>.</p>
888
+ </li></ul>
889
+
890
+ <p>Each of these will have their pros and cons. The default is <code>:yaml</code> because that is the most portable. <code>:marshal</code> tends to be faster but is incompatible across minor Ruby versions.</p>
891
+
892
+ <p>Your serializer choice is registered in a metadata table when <code>tablename</code> is created in the SQLite3 file. Afterward, it is an error to attempt to open the table with a different serializer and will result in a Lite3::Error exception.</p>
893
+
894
+ <h2 id="label-Caveats-3A">Caveats:</h2>
895
+ <ol><li>
896
+ <p>Both YAML and Marshal serialization have the usual security issues as described in the documentation for <code>Marshal</code> and <code>Psych</code>. If you are going to let an untrusted entity modify the database, you should not use these methods and instead stick to string conversion.</p>
897
+ </li><li>
898
+ <p><code>DBM</code> does not check your Marshal version; a mismatch will fail dramatically at exactly the wrong time.</p>
899
+ </li><li>
900
+ <p><code>filename</code> is normalized using <code>File.realpath</code> and this path is used to look up an existing database handle if one exists. Using hard links or other trickery to defeat this mechanism and open a second handle to the same database is <strong>probably</strong> still harmless but is not something this API guarantees will work correctly.</p>
901
+ </li></ol>
902
+
903
+
904
+ </div>
905
+ </div>
906
+ <div class="tags">
907
+
908
+
909
+ </div><table class="source_code">
910
+ <tr>
911
+ <td>
912
+ <pre class="lines">
913
+
914
+
915
+ 67
916
+ 68
917
+ 69
918
+ 70
919
+ 71
920
+ 72
921
+ 73
922
+ 74
923
+ 75
924
+ 76
925
+ 77
926
+ 78
927
+ 79
928
+ 80
929
+ 81
930
+ 82
931
+ 83
932
+ 84
933
+ 85
934
+ 86
935
+ 87</pre>
936
+ </td>
937
+ <td>
938
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 67</span>
939
+
940
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='rparen'>)</span>
941
+ <span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
942
+ <span class='ivar'>@tablename</span> <span class='op'>=</span> <span class='id identifier rubyid_tablename'>tablename</span>
943
+ <span class='ivar'>@valenc</span><span class='comma'>,</span>
944
+ <span class='ivar'>@valdec</span> <span class='op'>=</span> <span class='id identifier rubyid_value_encoders'>value_encoders</span><span class='lparen'>(</span><span class='id identifier rubyid_serializer'>serializer</span><span class='rparen'>)</span>
945
+ <span class='ivar'>@handle</span> <span class='op'>=</span> <span class='const'>HandlePool</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
946
+
947
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_addref'>addref</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
948
+
949
+ <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Malformed table name &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tablename'>tablename</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;; must be a valid identifer</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
950
+ <span class='id identifier rubyid_tablename'>tablename</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[a-zA-Z_]\w*$</span><span class='regexp_end'>/</span></span>
951
+ <span class='rbrace'>}</span>
952
+
953
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
954
+ <span class='id identifier rubyid_register_serialization_scheme'>register_serialization_scheme</span><span class='lparen'>(</span><span class='id identifier rubyid_serializer'>serializer</span><span class='rparen'>)</span>
955
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_create_key_value_table'>create_key_value_table</span><span class='lparen'>(</span> <span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='rparen'>)</span>
956
+ <span class='rbrace'>}</span>
957
+ <span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="Error.html" title="Lite3::Error (class)">Error</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
958
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span> <span class='kw'>if</span> <span class='ivar'>@handle</span>
959
+ <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span>
960
+ <span class='kw'>end</span></pre>
961
+ </td>
962
+ </tr>
963
+ </table>
964
+ </div>
965
+
966
+ </div>
967
+
968
+
969
+ <div id="class_method_details" class="method_details_list">
970
+ <h2>Class Method Details</h2>
971
+
972
+
973
+ <div class="method_details first">
974
+ <h3 class="signature first" id="open-class_method">
975
+
976
+ .<strong>open</strong>(filename, tablename, serializer = :yaml, &amp;block) &#x21d2; <tt>Object</tt>
977
+
978
+
979
+
980
+
981
+
982
+ </h3><div class="docstring">
983
+ <div class="discussion">
984
+
985
+ <p>Identical to <code>initialize</code> except that if a block is provided, it is evaluated with a new Lite3::DBM which is then closed afterward. This is analagous to <code>File.open</code>.</p>
986
+
987
+
988
+ </div>
989
+ </div>
990
+ <div class="tags">
991
+
992
+
993
+ </div><table class="source_code">
994
+ <tr>
995
+ <td>
996
+ <pre class="lines">
997
+
998
+
999
+ 93
1000
+ 94
1001
+ 95
1002
+ 96
1003
+ 97
1004
+ 98
1005
+ 99
1006
+ 100
1007
+ 101
1008
+ 102</pre>
1009
+ </td>
1010
+ <td>
1011
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 93</span>
1012
+
1013
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1014
+ <span class='id identifier rubyid_instance'>instance</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span><span class='rparen'>)</span>
1015
+ <span class='kw'>return</span> <span class='id identifier rubyid_instance'>instance</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
1016
+
1017
+ <span class='kw'>begin</span>
1018
+ <span class='kw'>return</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_instance'>instance</span><span class='rparen'>)</span>
1019
+ <span class='kw'>ensure</span>
1020
+ <span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
1021
+ <span class='kw'>end</span>
1022
+ <span class='kw'>end</span></pre>
1023
+ </td>
1024
+ </tr>
1025
+ </table>
1026
+ </div>
1027
+
1028
+ </div>
1029
+
1030
+ <div id="instance_method_details" class="method_details_list">
1031
+ <h2>Instance Method Details</h2>
1032
+
1033
+
1034
+ <div class="method_details first">
1035
+ <h3 class="signature first" id="[]-instance_method">
1036
+
1037
+ #<strong>[]</strong>(key) &#x21d2; <tt>Object</tt>
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+ </h3><div class="docstring">
1044
+ <div class="discussion">
1045
+
1046
+ <p>Retrieve the value associated with <code>key</code> from the database or nil if it is not present.</p>
1047
+
1048
+
1049
+ </div>
1050
+ </div>
1051
+ <div class="tags">
1052
+
1053
+
1054
+ </div><table class="source_code">
1055
+ <tr>
1056
+ <td>
1057
+ <pre class="lines">
1058
+
1059
+
1060
+ 262
1061
+ 263
1062
+ 264</pre>
1063
+ </td>
1064
+ <td>
1065
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 262</span>
1066
+
1067
+ <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1068
+ <span class='kw'>return</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1069
+ <span class='kw'>end</span></pre>
1070
+ </td>
1071
+ </tr>
1072
+ </table>
1073
+ </div>
1074
+
1075
+ <div class="method_details ">
1076
+ <h3 class="signature " id="[]=-instance_method">
1077
+
1078
+ #<strong>[]=</strong>(key, value) &#x21d2; <tt>Object</tt>
1079
+
1080
+
1081
+
1082
+ <span class="aliases">Also known as:
1083
+ <span class="names"><span id='store-instance_method'>store</span></span>
1084
+ </span>
1085
+
1086
+
1087
+
1088
+ </h3><div class="docstring">
1089
+ <div class="discussion">
1090
+
1091
+ <p>Store <code>value</code> at <code>key</code> in the database.</p>
1092
+
1093
+ <p><code>key</code> <strong>must</strong> be a String or a Symbol; Symbols are transparently converted to Strings.</p>
1094
+
1095
+ <p><code>value</code> <strong>must</strong> be convertable to string by whichever serialization method you have chosen.</p>
1096
+
1097
+
1098
+ </div>
1099
+ </div>
1100
+ <div class="tags">
1101
+
1102
+
1103
+ </div><table class="source_code">
1104
+ <tr>
1105
+ <td>
1106
+ <pre class="lines">
1107
+
1108
+
1109
+ 250
1110
+ 251
1111
+ 252
1112
+ 253
1113
+ 254
1114
+ 255
1115
+ 256
1116
+ 257</pre>
1117
+ </td>
1118
+ <td>
1119
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 250</span>
1120
+
1121
+ <span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1122
+ <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_check_key'>check_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1123
+ <span class='id identifier rubyid_valstr'>valstr</span> <span class='op'>=</span> <span class='ivar'>@valenc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1124
+
1125
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_upsert'>upsert</span><span class='lparen'>(</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_valstr'>valstr</span><span class='rparen'>)</span>
1126
+
1127
+ <span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span>
1128
+ <span class='kw'>end</span></pre>
1129
+ </td>
1130
+ </tr>
1131
+ </table>
1132
+ </div>
1133
+
1134
+ <div class="method_details ">
1135
+ <h3 class="signature " id="clear-instance_method">
1136
+
1137
+ #<strong>clear</strong> &#x21d2; <tt>Object</tt>
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+ </h3><div class="docstring">
1144
+ <div class="discussion">
1145
+
1146
+ <p>Delete all entries from the table.</p>
1147
+
1148
+
1149
+ </div>
1150
+ </div>
1151
+ <div class="tags">
1152
+
1153
+
1154
+ </div><table class="source_code">
1155
+ <tr>
1156
+ <td>
1157
+ <pre class="lines">
1158
+
1159
+
1160
+ 348
1161
+ 349
1162
+ 350</pre>
1163
+ </td>
1164
+ <td>
1165
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 348</span>
1166
+
1167
+ <span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
1168
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_clear_table'>clear_table</span><span class='lparen'>(</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='rparen'>)</span>
1169
+ <span class='kw'>end</span></pre>
1170
+ </td>
1171
+ </tr>
1172
+ </table>
1173
+ </div>
1174
+
1175
+ <div class="method_details ">
1176
+ <h3 class="signature " id="close-instance_method">
1177
+
1178
+ #<strong>close</strong> &#x21d2; <tt>Object</tt>
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+ </h3><div class="docstring">
1185
+ <div class="discussion">
1186
+
1187
+ <p>Disassociate <code>self</code> from the underlying database. If this is the last <code>DBM</code> using it, the handle will (probably) also be closed.</p>
1188
+
1189
+ <p>Subsequent attempts to use <code>self</code> will fail with an error; the only exception to this is the method <code>closed?</code> which will return true.</p>
1190
+
1191
+
1192
+ </div>
1193
+ </div>
1194
+ <div class="tags">
1195
+
1196
+
1197
+ </div><table class="source_code">
1198
+ <tr>
1199
+ <td>
1200
+ <pre class="lines">
1201
+
1202
+
1203
+ 185
1204
+ 186
1205
+ 187
1206
+ 188</pre>
1207
+ </td>
1208
+ <td>
1209
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 185</span>
1210
+
1211
+ <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
1212
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_delref'>delref</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
1213
+ <span class='ivar'>@handle</span> <span class='op'>=</span> <span class='const'>ClosedHandle</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@filename</span><span class='comma'>,</span> <span class='ivar'>@tablename</span><span class='rparen'>)</span>
1214
+ <span class='kw'>end</span></pre>
1215
+ </td>
1216
+ </tr>
1217
+ </table>
1218
+ </div>
1219
+
1220
+ <div class="method_details ">
1221
+ <h3 class="signature " id="closed?-instance_method">
1222
+
1223
+ #<strong>closed?</strong> &#x21d2; <tt>Boolean</tt>
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+ </h3><div class="docstring">
1230
+ <div class="discussion">
1231
+
1232
+ <p>Test if this object has been closed. This is safe to call on a closed <code>DBM</code>.</p>
1233
+
1234
+
1235
+ </div>
1236
+ </div>
1237
+ <div class="tags">
1238
+
1239
+ <p class="tag_title">Returns:</p>
1240
+ <ul class="return">
1241
+
1242
+ <li>
1243
+
1244
+
1245
+ <span class='type'>(<tt>Boolean</tt>)</span>
1246
+
1247
+
1248
+
1249
+ </li>
1250
+
1251
+ </ul>
1252
+
1253
+ </div><table class="source_code">
1254
+ <tr>
1255
+ <td>
1256
+ <pre class="lines">
1257
+
1258
+
1259
+ 192
1260
+ 193
1261
+ 194</pre>
1262
+ </td>
1263
+ <td>
1264
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 192</span>
1265
+
1266
+ <span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
1267
+ <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>ClosedHandle</span>
1268
+ <span class='kw'>end</span></pre>
1269
+ </td>
1270
+ </tr>
1271
+ </table>
1272
+ </div>
1273
+
1274
+ <div class="method_details ">
1275
+ <h3 class="signature " id="delete-instance_method">
1276
+
1277
+ #<strong>delete</strong>(key) &#x21d2; <tt>Object</tt>
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+ </h3><div class="docstring">
1284
+ <div class="discussion">
1285
+
1286
+ <p>Remove <code>key</code> and its associated value from <code>self</code>. If <code>key</code> is not present, does nothing.</p>
1287
+
1288
+
1289
+ </div>
1290
+ </div>
1291
+ <div class="tags">
1292
+
1293
+
1294
+ </div><table class="source_code">
1295
+ <tr>
1296
+ <td>
1297
+ <pre class="lines">
1298
+
1299
+
1300
+ 434
1301
+ 435
1302
+ 436</pre>
1303
+ </td>
1304
+ <td>
1305
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 434</span>
1306
+
1307
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1308
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1309
+ <span class='kw'>end</span></pre>
1310
+ </td>
1311
+ </tr>
1312
+ </table>
1313
+ </div>
1314
+
1315
+ <div class="method_details ">
1316
+ <h3 class="signature " id="delete_if-instance_method">
1317
+
1318
+ #<strong>delete_if</strong> {|value| ... } &#x21d2; <tt>Object</tt>
1319
+
1320
+
1321
+
1322
+ <span class="aliases">Also known as:
1323
+ <span class="names"><span id='reject!-instance_method'>reject!</span></span>
1324
+ </span>
1325
+
1326
+
1327
+
1328
+ </h3><div class="docstring">
1329
+ <div class="discussion">
1330
+
1331
+ <p>Evaluate the block on each key-value pair in <code>self</code> end delete each entry for which the block returns true.</p>
1332
+
1333
+
1334
+ </div>
1335
+ </div>
1336
+ <div class="tags">
1337
+
1338
+ <p class="tag_title">Yields:</p>
1339
+ <ul class="yield">
1340
+
1341
+ <li>
1342
+
1343
+
1344
+ <span class='type'>(<tt>value</tt>)</span>
1345
+
1346
+
1347
+
1348
+ &mdash;
1349
+ <div class='inline'>
1350
+ <p>The block to evaluate</p>
1351
+ </div>
1352
+
1353
+ </li>
1354
+
1355
+ </ul>
1356
+
1357
+ </div><table class="source_code">
1358
+ <tr>
1359
+ <td>
1360
+ <pre class="lines">
1361
+
1362
+
1363
+ 442
1364
+ 443
1365
+ 444
1366
+ 445
1367
+ 446</pre>
1368
+ </td>
1369
+ <td>
1370
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 442</span>
1371
+
1372
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete_if'>delete_if</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1373
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
1374
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1375
+ <span class='rbrace'>}</span>
1376
+ <span class='kw'>end</span></pre>
1377
+ </td>
1378
+ </tr>
1379
+ </table>
1380
+ </div>
1381
+
1382
+ <div class="method_details ">
1383
+ <h3 class="signature " id="each-instance_method">
1384
+
1385
+ #<strong>each</strong> {|key, value| ... } &#x21d2; <tt>Object</tt>
1386
+
1387
+
1388
+
1389
+ <span class="aliases">Also known as:
1390
+ <span class="names"><span id='each_pair-instance_method'>each_pair</span></span>
1391
+ </span>
1392
+
1393
+
1394
+
1395
+ </h3><div class="docstring">
1396
+ <div class="discussion">
1397
+
1398
+ <p>Calls the given block with each key-value pair in the usual order, then return self. The entire call takes place in its own transaction.</p>
1399
+
1400
+ <p>It is safe to modify <code>self</code> inside the block.</p>
1401
+
1402
+ <p>If no block is given, returns an Enumerator instead. The Enumerator does <em>not</em> start a transaction but individual accesses of it (e.g. calling <code>next</code>) each take place in their own transaction.</p>
1403
+
1404
+
1405
+ </div>
1406
+ </div>
1407
+ <div class="tags">
1408
+
1409
+ <p class="tag_title">Yields:</p>
1410
+ <ul class="yield">
1411
+
1412
+ <li>
1413
+
1414
+
1415
+ <span class='type'>(<tt>key</tt>, <tt>value</tt>)</span>
1416
+
1417
+
1418
+
1419
+ &mdash;
1420
+ <div class='inline'>
1421
+ <p>The block to evaluate</p>
1422
+ </div>
1423
+
1424
+ </li>
1425
+
1426
+ </ul>
1427
+
1428
+ </div><table class="source_code">
1429
+ <tr>
1430
+ <td>
1431
+ <pre class="lines">
1432
+
1433
+
1434
+ 386
1435
+ 387
1436
+ 388
1437
+ 389
1438
+ 390</pre>
1439
+ </td>
1440
+ <td>
1441
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 386</span>
1442
+
1443
+ <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_block'>block</span><span class='rparen'>)</span>
1444
+ <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:nt_each</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
1445
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_nt_each'>nt_each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1446
+ <span class='kw'>return</span> <span class='kw'>self</span>
1447
+ <span class='kw'>end</span></pre>
1448
+ </td>
1449
+ </tr>
1450
+ </table>
1451
+ </div>
1452
+
1453
+ <div class="method_details ">
1454
+ <h3 class="signature " id="each_key-instance_method">
1455
+
1456
+ #<strong>each_key</strong> {|key| ... } &#x21d2; <tt>Object</tt>
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+ </h3><div class="docstring">
1463
+ <div class="discussion">
1464
+
1465
+ <p>Calls the given block with each key; returns self. Exactly like <code>each</code> except for the block argument.</p>
1466
+
1467
+
1468
+ </div>
1469
+ </div>
1470
+ <div class="tags">
1471
+
1472
+ <p class="tag_title">Yields:</p>
1473
+ <ul class="yield">
1474
+
1475
+ <li>
1476
+
1477
+
1478
+ <span class='type'>(<tt>key</tt>)</span>
1479
+
1480
+
1481
+
1482
+ &mdash;
1483
+ <div class='inline'>
1484
+ <p>The block to evaluate</p>
1485
+ </div>
1486
+
1487
+ </li>
1488
+
1489
+ </ul>
1490
+
1491
+ </div><table class="source_code">
1492
+ <tr>
1493
+ <td>
1494
+ <pre class="lines">
1495
+
1496
+
1497
+ 409
1498
+ 410
1499
+ 411
1500
+ 412</pre>
1501
+ </td>
1502
+ <td>
1503
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 409</span>
1504
+
1505
+ <span class='kw'>def</span> <span class='id identifier rubyid_each_key'>each_key</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1506
+ <span class='kw'>return</span> <span class='const'>Enumerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_y'>y</span><span class='op'>|</span> <span class='id identifier rubyid_nt_each'>nt_each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_y'>y</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_k'>k</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
1507
+ <span class='kw'>return</span> <span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1508
+ <span class='kw'>end</span></pre>
1509
+ </td>
1510
+ </tr>
1511
+ </table>
1512
+ </div>
1513
+
1514
+ <div class="method_details ">
1515
+ <h3 class="signature " id="each_value-instance_method">
1516
+
1517
+ #<strong>each_value</strong> {|value| ... } &#x21d2; <tt>Object</tt>
1518
+
1519
+
1520
+
1521
+
1522
+
1523
+ </h3><div class="docstring">
1524
+ <div class="discussion">
1525
+
1526
+ <p>Calls the given block with each value; returns self. Exactly like <code>each</code> except for the block argument.</p>
1527
+
1528
+
1529
+ </div>
1530
+ </div>
1531
+ <div class="tags">
1532
+
1533
+ <p class="tag_title">Yields:</p>
1534
+ <ul class="yield">
1535
+
1536
+ <li>
1537
+
1538
+
1539
+ <span class='type'>(<tt>value</tt>)</span>
1540
+
1541
+
1542
+
1543
+ &mdash;
1544
+ <div class='inline'>
1545
+ <p>The block to evaluate</p>
1546
+ </div>
1547
+
1548
+ </li>
1549
+
1550
+ </ul>
1551
+
1552
+ </div><table class="source_code">
1553
+ <tr>
1554
+ <td>
1555
+ <pre class="lines">
1556
+
1557
+
1558
+ 418
1559
+ 419
1560
+ 420
1561
+ 421</pre>
1562
+ </td>
1563
+ <td>
1564
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 418</span>
1565
+
1566
+ <span class='kw'>def</span> <span class='id identifier rubyid_each_value'>each_value</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1567
+ <span class='kw'>return</span> <span class='const'>Enumerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_y'>y</span><span class='op'>|</span> <span class='id identifier rubyid_nt_each'>nt_each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_y'>y</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
1568
+ <span class='kw'>return</span> <span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1569
+ <span class='kw'>end</span></pre>
1570
+ </td>
1571
+ </tr>
1572
+ </table>
1573
+ </div>
1574
+
1575
+ <div class="method_details ">
1576
+ <h3 class="signature " id="empty?-instance_method">
1577
+
1578
+ #<strong>empty?</strong> &#x21d2; <tt>Boolean</tt>
1579
+
1580
+
1581
+
1582
+
1583
+
1584
+ </h3><div class="docstring">
1585
+ <div class="discussion">
1586
+
1587
+ <p>Test if <code>self</code> is empty.</p>
1588
+
1589
+
1590
+ </div>
1591
+ </div>
1592
+ <div class="tags">
1593
+
1594
+ <p class="tag_title">Returns:</p>
1595
+ <ul class="return">
1596
+
1597
+ <li>
1598
+
1599
+
1600
+ <span class='type'>(<tt>Boolean</tt>)</span>
1601
+
1602
+
1603
+
1604
+ </li>
1605
+
1606
+ </ul>
1607
+
1608
+ </div><table class="source_code">
1609
+ <tr>
1610
+ <td>
1611
+ <pre class="lines">
1612
+
1613
+
1614
+ 456
1615
+ 457
1616
+ 458</pre>
1617
+ </td>
1618
+ <td>
1619
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 456</span>
1620
+
1621
+ <span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
1622
+ <span class='kw'>return</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>0</span>
1623
+ <span class='kw'>end</span></pre>
1624
+ </td>
1625
+ </tr>
1626
+ </table>
1627
+ </div>
1628
+
1629
+ <div class="method_details ">
1630
+ <h3 class="signature " id="fast_each-instance_method">
1631
+
1632
+ #<strong>fast_each</strong> {|key, value| ... } &#x21d2; <tt>Object</tt>
1633
+
1634
+
1635
+
1636
+
1637
+
1638
+ </h3><div class="docstring">
1639
+ <div class="discussion">
1640
+
1641
+ <p>Behaves like &#39;each&#39; with a block–that is, call it for each key/value pair–but (probably) executes faster.</p>
1642
+
1643
+ <p>The downside is that there is no guarantee of reentrance or safety. The block <em>MUST NOT</em> access the database in any way. In addition, no guarantee is made about element order.</p>
1644
+
1645
+ <p>(You might be able to infer some ways to safely bend the rules by seeing what the underlying database libraries allow, but your code won&#39;t be future-proof if you do that.)</p>
1646
+
1647
+
1648
+ </div>
1649
+ </div>
1650
+ <div class="tags">
1651
+
1652
+ <p class="tag_title">Yields:</p>
1653
+ <ul class="yield">
1654
+
1655
+ <li>
1656
+
1657
+
1658
+ <span class='type'>(<tt>key</tt>, <tt>value</tt>)</span>
1659
+
1660
+
1661
+
1662
+ &mdash;
1663
+ <div class='inline'>
1664
+ <p>The block to evaluate</p>
1665
+ </div>
1666
+
1667
+ </li>
1668
+
1669
+ </ul>
1670
+
1671
+ </div><table class="source_code">
1672
+ <tr>
1673
+ <td>
1674
+ <pre class="lines">
1675
+
1676
+
1677
+ 365
1678
+ 366
1679
+ 367
1680
+ 368
1681
+ 369
1682
+ 370
1683
+ 371</pre>
1684
+ </td>
1685
+ <td>
1686
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 365</span>
1687
+
1688
+ <span class='kw'>def</span> <span class='id identifier rubyid_fast_each'>fast_each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1689
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
1690
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_tbl_each_fast'>tbl_each_fast</span><span class='lparen'>(</span> <span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
1691
+ <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@valdec</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='semicolon'>;</span>
1692
+ <span class='rbrace'>}</span>
1693
+ <span class='rbrace'>}</span>
1694
+ <span class='kw'>end</span></pre>
1695
+ </td>
1696
+ </tr>
1697
+ </table>
1698
+ </div>
1699
+
1700
+ <div class="method_details ">
1701
+ <h3 class="signature " id="fetch-instance_method">
1702
+
1703
+ #<strong>fetch</strong>(key, *args) {|key| ... } &#x21d2; <tt>Object</tt>
1704
+
1705
+
1706
+
1707
+
1708
+
1709
+ </h3><div class="docstring">
1710
+ <div class="discussion">
1711
+
1712
+ <p>Retrieve the value associated with <code>key</code>.</p>
1713
+
1714
+ <p><code>key</code> <strong>must</strong> be a String or a Symbol; Symbols are transparently converted to Strings.</p>
1715
+
1716
+ <p>If it is not present and a block is given, evaluate the block with the key as its argument and return that.</p>
1717
+
1718
+ <p>If no block was given either but one extra parameter was given, that value is returned instead.</p>
1719
+
1720
+ <p>Finally, if none of these was given, it throws an <code>IndexError</code> exception.</p>
1721
+
1722
+ <p>It is an error if <code>fetch</code> is called with more than two arguments.</p>
1723
+
1724
+
1725
+ </div>
1726
+ </div>
1727
+ <div class="tags">
1728
+
1729
+ <p class="tag_title">Yields:</p>
1730
+ <ul class="yield">
1731
+
1732
+ <li>
1733
+
1734
+
1735
+ <span class='type'>(<tt>key</tt>)</span>
1736
+
1737
+
1738
+
1739
+ &mdash;
1740
+ <div class='inline'>
1741
+ <p>The fallback block.</p>
1742
+ </div>
1743
+
1744
+ </li>
1745
+
1746
+ </ul>
1747
+ <p class="tag_title">Raises:</p>
1748
+ <ul class="raise">
1749
+
1750
+ <li>
1751
+
1752
+
1753
+ <span class='type'>(<tt>IndexError</tt>)</span>
1754
+
1755
+
1756
+
1757
+ </li>
1758
+
1759
+ </ul>
1760
+
1761
+ </div><table class="source_code">
1762
+ <tr>
1763
+ <td>
1764
+ <pre class="lines">
1765
+
1766
+
1767
+ 283
1768
+ 284
1769
+ 285
1770
+ 286
1771
+ 287
1772
+ 288
1773
+ 289
1774
+ 290
1775
+ 291
1776
+ 292
1777
+ 293
1778
+ 294
1779
+ 295
1780
+ 296
1781
+ 297
1782
+ 298
1783
+ 299
1784
+ 300
1785
+ 301
1786
+ 302
1787
+ 303
1788
+ 304
1789
+ 305
1790
+ 306
1791
+ 307
1792
+ 308</pre>
1793
+ </td>
1794
+ <td>
1795
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 283</span>
1796
+
1797
+ <span class='kw'>def</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_default_block'>default_block</span><span class='rparen'>)</span>
1798
+
1799
+ <span class='comment'># Ensure there are no extra arguments
1800
+ </span> <span class='id identifier rubyid_nargs'>nargs</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>+</span> <span class='int'>1</span>
1801
+ <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Too many arguments for &#39;fetch&#39;; expected 1 or 2; got </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nargs'>nargs</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span>
1802
+ <span class='id identifier rubyid_nargs'>nargs</span> <span class='op'>&lt;=</span> <span class='int'>2</span>
1803
+ <span class='rbrace'>}</span>
1804
+
1805
+ <span class='comment'># Retrieve the value
1806
+ </span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_check_key'>check_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1807
+
1808
+ <span class='comment'># Return the value if found. (nil will always mean the entry
1809
+ </span> <span class='comment'># isn&#39;t present because values are encoded in strings.)
1810
+ </span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_lookup'>lookup</span><span class='lparen'>(</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1811
+ <span class='kw'>return</span> <span class='ivar'>@valdec</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span>
1812
+
1813
+ <span class='comment'># Not found. If a block was given, evaluate it and return its
1814
+ </span> <span class='comment'># result.
1815
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_default_block'>default_block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_default_block'>default_block</span>
1816
+
1817
+ <span class='comment'># Next, see if we have a default value we can return
1818
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&gt;</span> <span class='int'>0</span>
1819
+
1820
+ <span class='comment'># And if all else fails, raise an IndexError.
1821
+ </span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>IndexError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>key &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; not found.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1822
+ <span class='kw'>end</span></pre>
1823
+ </td>
1824
+ </tr>
1825
+ </table>
1826
+ </div>
1827
+
1828
+ <div class="method_details ">
1829
+ <h3 class="signature " id="has_key?-instance_method">
1830
+
1831
+ #<strong>has_key?</strong>(key) &#x21d2; <tt>Boolean</tt>
1832
+
1833
+
1834
+
1835
+ <span class="aliases">Also known as:
1836
+ <span class="names"><span id='include?-instance_method'>include?</span>, <span id='member?-instance_method'>member?</span>, <span id='key?-instance_method'>key?</span></span>
1837
+ </span>
1838
+
1839
+
1840
+
1841
+ </h3><div class="docstring">
1842
+ <div class="discussion">
1843
+
1844
+ <p>Return <code>true</code> if the table contains <code>key</code>; otherwise, return <code>false</code>.</p>
1845
+
1846
+
1847
+ </div>
1848
+ </div>
1849
+ <div class="tags">
1850
+
1851
+ <p class="tag_title">Returns:</p>
1852
+ <ul class="return">
1853
+
1854
+ <li>
1855
+
1856
+
1857
+ <span class='type'>(<tt>Boolean</tt>)</span>
1858
+
1859
+
1860
+
1861
+ </li>
1862
+
1863
+ </ul>
1864
+
1865
+ </div><table class="source_code">
1866
+ <tr>
1867
+ <td>
1868
+ <pre class="lines">
1869
+
1870
+
1871
+ 338
1872
+ 339
1873
+ 340
1874
+ 341
1875
+ 342</pre>
1876
+ </td>
1877
+ <td>
1878
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 338</span>
1879
+
1880
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1881
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>String</span> <span class='op'>||</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Symbol</span>
1882
+ <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='rbrace'>}</span>
1883
+ <span class='kw'>return</span> <span class='kw'>true</span>
1884
+ <span class='kw'>end</span></pre>
1885
+ </td>
1886
+ </tr>
1887
+ </table>
1888
+ </div>
1889
+
1890
+ <div class="method_details ">
1891
+ <h3 class="signature " id="has_value?-instance_method">
1892
+
1893
+ #<strong>has_value?</strong>(val) &#x21d2; <tt>Boolean</tt>
1894
+
1895
+
1896
+
1897
+ <span class="aliases">Also known as:
1898
+ <span class="names"><span id='value?-instance_method'>value?</span></span>
1899
+ </span>
1900
+
1901
+
1902
+
1903
+ </h3><div class="docstring">
1904
+ <div class="discussion">
1905
+
1906
+ <p>Test if <code>val</code> is one of the values in this table.</p>
1907
+
1908
+ <p>Potentially very slow, especially on large tables.</p>
1909
+
1910
+
1911
+ </div>
1912
+ </div>
1913
+ <div class="tags">
1914
+
1915
+ <p class="tag_title">Returns:</p>
1916
+ <ul class="return">
1917
+
1918
+ <li>
1919
+
1920
+
1921
+ <span class='type'>(<tt>Boolean</tt>)</span>
1922
+
1923
+
1924
+
1925
+ </li>
1926
+
1927
+ </ul>
1928
+
1929
+ </div><table class="source_code">
1930
+ <tr>
1931
+ <td>
1932
+ <pre class="lines">
1933
+
1934
+
1935
+ 499
1936
+ 500
1937
+ 501
1938
+ 502</pre>
1939
+ </td>
1940
+ <td>
1941
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 499</span>
1942
+
1943
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_value?'>has_value?</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
1944
+ <span class='id identifier rubyid_fast_each'>fast_each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span> <span class='rbrace'>}</span>
1945
+ <span class='kw'>return</span> <span class='kw'>false</span>
1946
+ <span class='kw'>end</span></pre>
1947
+ </td>
1948
+ </tr>
1949
+ </table>
1950
+ </div>
1951
+
1952
+ <div class="method_details ">
1953
+ <h3 class="signature " id="invert-instance_method">
1954
+
1955
+ #<strong>invert</strong> &#x21d2; <tt>Object</tt>
1956
+
1957
+
1958
+
1959
+
1960
+
1961
+ </h3><div class="docstring">
1962
+ <div class="discussion">
1963
+
1964
+ <p>Return a <code>Hash</code> whose keys are the table&#39;s values and whose values are the table&#39;s keys.</p>
1965
+
1966
+ <p><strong>WARNING:</strong> it is possible for tables to be significantly larger than available RAM; in that case, this will likely crash your program.</p>
1967
+
1968
+
1969
+ </div>
1970
+ </div>
1971
+ <div class="tags">
1972
+
1973
+
1974
+ </div><table class="source_code">
1975
+ <tr>
1976
+ <td>
1977
+ <pre class="lines">
1978
+
1979
+
1980
+ 511
1981
+ 512
1982
+ 513
1983
+ 514
1984
+ 515</pre>
1985
+ </td>
1986
+ <td>
1987
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 511</span>
1988
+
1989
+ <span class='kw'>def</span> <span class='id identifier rubyid_invert'>invert</span>
1990
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1991
+ <span class='id identifier rubyid_fast_each'>fast_each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span><span class='rbrace'>}</span>
1992
+ <span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
1993
+ <span class='kw'>end</span></pre>
1994
+ </td>
1995
+ </tr>
1996
+ </table>
1997
+ </div>
1998
+
1999
+ <div class="method_details ">
2000
+ <h3 class="signature " id="keys-instance_method">
2001
+
2002
+ #<strong>keys</strong> &#x21d2; <tt>Object</tt>
2003
+
2004
+
2005
+
2006
+
2007
+
2008
+ </h3><div class="docstring">
2009
+ <div class="discussion">
2010
+
2011
+ <p>Return an <code>Array</code> of all of the keys in the table.</p>
2012
+
2013
+ <p><strong>WARNING:</strong> since this list is being read from disk, it is possible that the result could exceed available memory.</p>
2014
+
2015
+
2016
+ </div>
2017
+ </div>
2018
+ <div class="tags">
2019
+
2020
+
2021
+ </div><table class="source_code">
2022
+ <tr>
2023
+ <td>
2024
+ <pre class="lines">
2025
+
2026
+
2027
+ 320
2028
+ 321
2029
+ 322
2030
+ 323
2031
+ 324</pre>
2032
+ </td>
2033
+ <td>
2034
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 320</span>
2035
+
2036
+ <span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
2037
+ <span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2038
+ <span class='id identifier rubyid_fast_each'>fast_each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_k'>k</span> <span class='rbrace'>}</span>
2039
+ <span class='kw'>return</span> <span class='id identifier rubyid_keys'>keys</span>
2040
+ <span class='kw'>end</span></pre>
2041
+ </td>
2042
+ </tr>
2043
+ </table>
2044
+ </div>
2045
+
2046
+ <div class="method_details ">
2047
+ <h3 class="signature " id="shift-instance_method">
2048
+
2049
+ #<strong>shift</strong> &#x21d2; <tt>Object</tt>
2050
+
2051
+
2052
+
2053
+
2054
+
2055
+ </h3><div class="docstring">
2056
+ <div class="discussion">
2057
+
2058
+ <p>Remove the first key/value pair from <code>self</code> and return it. “First” is defined by <code>self</code>&#39;s row order, which is the order of insertion as determined by SQLite3.</p>
2059
+
2060
+
2061
+ </div>
2062
+ </div>
2063
+ <div class="tags">
2064
+
2065
+
2066
+ </div><table class="source_code">
2067
+ <tr>
2068
+ <td>
2069
+ <pre class="lines">
2070
+
2071
+
2072
+ 520
2073
+ 521
2074
+ 522
2075
+ 523
2076
+ 524
2077
+ 525
2078
+ 526
2079
+ 527
2080
+ 528
2081
+ 529</pre>
2082
+ </td>
2083
+ <td>
2084
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 520</span>
2085
+
2086
+ <span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span>
2087
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
2088
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_empty?'>empty?</span>
2089
+
2090
+ <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
2091
+ <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
2092
+
2093
+ <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span>
2094
+ <span class='rbrace'>}</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="size-instance_method">
2103
+
2104
+ #<strong>size</strong> &#x21d2; <tt>Object</tt>
2105
+
2106
+
2107
+
2108
+ <span class="aliases">Also known as:
2109
+ <span class="names"><span id='length-instance_method'>length</span></span>
2110
+ </span>
2111
+
2112
+
2113
+
2114
+ </h3><div class="docstring">
2115
+ <div class="discussion">
2116
+
2117
+ <p>Return the number of entries (key-value pairs) in <code>self</code>.</p>
2118
+
2119
+
2120
+ </div>
2121
+ </div>
2122
+ <div class="tags">
2123
+
2124
+
2125
+ </div><table class="source_code">
2126
+ <tr>
2127
+ <td>
2128
+ <pre class="lines">
2129
+
2130
+
2131
+ 450
2132
+ 451
2133
+ 452</pre>
2134
+ </td>
2135
+ <td>
2136
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 450</span>
2137
+
2138
+ <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
2139
+ <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_get_size'>get_size</span><span class='lparen'>(</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='rparen'>)</span>
2140
+ <span class='kw'>end</span></pre>
2141
+ </td>
2142
+ </tr>
2143
+ </table>
2144
+ </div>
2145
+
2146
+ <div class="method_details ">
2147
+ <h3 class="signature " id="to_a-instance_method">
2148
+
2149
+ #<strong>to_a</strong> &#x21d2; <tt>Object</tt>
2150
+
2151
+
2152
+
2153
+
2154
+
2155
+ </h3><div class="docstring">
2156
+ <div class="discussion">
2157
+
2158
+ <p>Returns an <code>Array</code> of 2-element <code>Array</code> objects each containing a key-value pair from <code>self</code>.</p>
2159
+
2160
+ <p><strong>WARNING:</strong> it is possible for tables to be significantly larger than available RAM; in that case, this will likely crash your program.</p>
2161
+
2162
+
2163
+ </div>
2164
+ </div>
2165
+ <div class="tags">
2166
+
2167
+
2168
+ </div><table class="source_code">
2169
+ <tr>
2170
+ <td>
2171
+ <pre class="lines">
2172
+
2173
+
2174
+ 484
2175
+ 485
2176
+ 486
2177
+ 487
2178
+ 488</pre>
2179
+ </td>
2180
+ <td>
2181
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 484</span>
2182
+
2183
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_a'>to_a</span>
2184
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2185
+ <span class='id identifier rubyid_fast_each'>fast_each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
2186
+ <span class='kw'>return</span> <span class='id identifier rubyid_result'>result</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="to_hash-instance_method">
2195
+
2196
+ #<strong>to_hash</strong> &#x21d2; <tt>Object</tt>
2197
+
2198
+
2199
+
2200
+
2201
+
2202
+ </h3><div class="docstring">
2203
+ <div class="discussion">
2204
+
2205
+ <p>Copies the table into a <code>Hash</code> and returns it.</p>
2206
+
2207
+ <p><strong>WARNING:</strong> it is possible for tables to be significantly larger than available RAM; in that case, this will likely crash your program.</p>
2208
+
2209
+
2210
+ </div>
2211
+ </div>
2212
+ <div class="tags">
2213
+
2214
+
2215
+ </div><table class="source_code">
2216
+ <tr>
2217
+ <td>
2218
+ <pre class="lines">
2219
+
2220
+
2221
+ 471
2222
+ 472
2223
+ 473
2224
+ 474
2225
+ 475</pre>
2226
+ </td>
2227
+ <td>
2228
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 471</span>
2229
+
2230
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span>
2231
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
2232
+ <span class='id identifier rubyid_fast_each'>fast_each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
2233
+ <span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
2234
+ <span class='kw'>end</span></pre>
2235
+ </td>
2236
+ </tr>
2237
+ </table>
2238
+ </div>
2239
+
2240
+ <div class="method_details ">
2241
+ <h3 class="signature " id="to_s-instance_method">
2242
+
2243
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
2244
+
2245
+
2246
+
2247
+ <span class="aliases">Also known as:
2248
+ <span class="names"><span id='inspect-instance_method'>inspect</span></span>
2249
+ </span>
2250
+
2251
+
2252
+
2253
+ </h3><table class="source_code">
2254
+ <tr>
2255
+ <td>
2256
+ <pre class="lines">
2257
+
2258
+
2259
+ 170
2260
+ 171
2261
+ 172
2262
+ 173
2263
+ 174</pre>
2264
+ </td>
2265
+ <td>
2266
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 170</span>
2267
+
2268
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
2269
+ <span class='id identifier rubyid_openstr'>openstr</span> <span class='op'>=</span> <span class='id identifier rubyid_closed?'>closed?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>CLOSED</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>OPEN</span><span class='tstring_end'>&#39;</span></span>
2270
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>:0x</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object_id'>object_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> file=&#39;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@filename</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
2271
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> tablename=&#39;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@tablename</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_openstr'>openstr</span><span class='embexpr_end'>}</span><span class='tstring_content'>&gt;</span><span class='tstring_end'>&quot;</span></span>
2272
+ <span class='kw'>end</span></pre>
2273
+ </td>
2274
+ </tr>
2275
+ </table>
2276
+ </div>
2277
+
2278
+ <div class="method_details ">
2279
+ <h3 class="signature " id="transaction-instance_method">
2280
+
2281
+ #<strong>transaction</strong> {|db| ... } &#x21d2; <tt>obj</tt>
2282
+
2283
+
2284
+
2285
+
2286
+
2287
+ </h3><div class="docstring">
2288
+ <div class="discussion">
2289
+
2290
+ <p>Begins a transaction, evaluates the given block and then ends the transaction. If no error occurred (i.e. an exception was thrown), the transaction is committed; otherwise, it is rolled back. Returns the block&#39;s result.</p>
2291
+
2292
+ <p>It is safe to call <code>DBM.transaction</code> within another <code>DBM.transaction</code> block&#39;s call chain because <code>DBM</code> will not start a new transaction on a database handle that already has one in progress. (It may be possible to trick <code>DBM</code> into trying via fibers or other flow control trickery; don&#39;t do that.)</p>
2293
+
2294
+ <p>Note that it&#39;s probably not a good idea to assume too much about the precise semantics; I can&#39;t guarantee that the underlying library(es) won&#39;t change or be replaced outright.</p>
2295
+
2296
+ <p>That being said, at present, this is simply a wrapper around <code>Sequel::Database.transaction</code> with the default options and so is subject to the quirks therein. In version 1.0.0, transactions were always executed in <code>:deferred</code> mode via the <code>sqlite3</code> gem.</p>
2297
+
2298
+
2299
+ </div>
2300
+ </div>
2301
+ <div class="tags">
2302
+
2303
+ <p class="tag_title">Yields:</p>
2304
+ <ul class="yield">
2305
+
2306
+ <li>
2307
+
2308
+
2309
+ <span class='type'>(<tt>db</tt>)</span>
2310
+
2311
+
2312
+
2313
+ &mdash;
2314
+ <div class='inline'>
2315
+ <p>The block takes a reference to the receiver as an argument.</p>
2316
+ </div>
2317
+
2318
+ </li>
2319
+
2320
+ </ul>
2321
+ <p class="tag_title">Returns:</p>
2322
+ <ul class="return">
2323
+
2324
+ <li>
2325
+
2326
+
2327
+ <span class='type'>(<tt>obj</tt>)</span>
2328
+
2329
+
2330
+
2331
+ &mdash;
2332
+ <div class='inline'>
2333
+ <p>Returns the block&#39;s result.</p>
2334
+ </div>
2335
+
2336
+ </li>
2337
+
2338
+ </ul>
2339
+
2340
+ </div><table class="source_code">
2341
+ <tr>
2342
+ <td>
2343
+ <pre class="lines">
2344
+
2345
+
2346
+ 228
2347
+ 229
2348
+ 230</pre>
2349
+ </td>
2350
+ <td>
2351
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 228</span>
2352
+
2353
+ <span class='kw'>def</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2354
+ <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
2355
+ <span class='kw'>end</span></pre>
2356
+ </td>
2357
+ </tr>
2358
+ </table>
2359
+ </div>
2360
+
2361
+ <div class="method_details ">
2362
+ <h3 class="signature " id="transaction_active?-instance_method">
2363
+
2364
+ #<strong>transaction_active?</strong> &#x21d2; <tt>Boolean</tt>
2365
+
2366
+
2367
+
2368
+
2369
+
2370
+ </h3><div class="docstring">
2371
+ <div class="discussion">
2372
+
2373
+ <p>Test if there is currently a transaction in progress</p>
2374
+
2375
+
2376
+ </div>
2377
+ </div>
2378
+ <div class="tags">
2379
+
2380
+ <p class="tag_title">Returns:</p>
2381
+ <ul class="return">
2382
+
2383
+ <li>
2384
+
2385
+
2386
+ <span class='type'>(<tt>Boolean</tt>)</span>
2387
+
2388
+
2389
+
2390
+ </li>
2391
+
2392
+ </ul>
2393
+
2394
+ </div><table class="source_code">
2395
+ <tr>
2396
+ <td>
2397
+ <pre class="lines">
2398
+
2399
+
2400
+ 233
2401
+ 234
2402
+ 235</pre>
2403
+ </td>
2404
+ <td>
2405
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 233</span>
2406
+
2407
+ <span class='kw'>def</span> <span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
2408
+ <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
2409
+ <span class='kw'>end</span></pre>
2410
+ </td>
2411
+ </tr>
2412
+ </table>
2413
+ </div>
2414
+
2415
+ <div class="method_details ">
2416
+ <h3 class="signature " id="update-instance_method">
2417
+
2418
+ #<strong>update</strong>(hash) &#x21d2; <tt>Object</tt>
2419
+
2420
+
2421
+
2422
+
2423
+
2424
+ </h3><div class="docstring">
2425
+ <div class="discussion">
2426
+
2427
+ <p>Updates the database with multiple values from the specified object. Takes any object which implements the each_pair method, including <code>Hash</code> and <code>DBM</code> objects.</p>
2428
+
2429
+
2430
+ </div>
2431
+ </div>
2432
+ <div class="tags">
2433
+
2434
+
2435
+ </div><table class="source_code">
2436
+ <tr>
2437
+ <td>
2438
+ <pre class="lines">
2439
+
2440
+
2441
+ 426
2442
+ 427
2443
+ 428
2444
+ 429
2445
+ 430</pre>
2446
+ </td>
2447
+ <td>
2448
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 426</span>
2449
+
2450
+ <span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
2451
+ <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
2452
+ <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
2453
+ <span class='rbrace'>}</span>
2454
+ <span class='kw'>end</span></pre>
2455
+ </td>
2456
+ </tr>
2457
+ </table>
2458
+ </div>
2459
+
2460
+ <div class="method_details ">
2461
+ <h3 class="signature " id="values-instance_method">
2462
+
2463
+ #<strong>values</strong> &#x21d2; <tt>Object</tt>
2464
+
2465
+
2466
+
2467
+
2468
+
2469
+ </h3><div class="docstring">
2470
+ <div class="discussion">
2471
+
2472
+ <p>Return an array of all values in the table.</p>
2473
+
2474
+ <p><strong>WARNING:</strong> since this list is being read from disk, it is possible that the result could exceed available memory.</p>
2475
+
2476
+
2477
+ </div>
2478
+ </div>
2479
+ <div class="tags">
2480
+
2481
+
2482
+ </div><table class="source_code">
2483
+ <tr>
2484
+ <td>
2485
+ <pre class="lines">
2486
+
2487
+
2488
+ 330
2489
+ 331
2490
+ 332
2491
+ 333
2492
+ 334</pre>
2493
+ </td>
2494
+ <td>
2495
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 330</span>
2496
+
2497
+ <span class='kw'>def</span> <span class='id identifier rubyid_values'>values</span>
2498
+ <span class='id identifier rubyid_values'>values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
2499
+ <span class='id identifier rubyid_fast_each'>fast_each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
2500
+ <span class='kw'>return</span> <span class='id identifier rubyid_values'>values</span>
2501
+ <span class='kw'>end</span></pre>
2502
+ </td>
2503
+ </tr>
2504
+ </table>
2505
+ </div>
2506
+
2507
+ <div class="method_details ">
2508
+ <h3 class="signature " id="values_at-instance_method">
2509
+
2510
+ #<strong>values_at</strong>(*keys) &#x21d2; <tt>Object</tt>
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+ </h3><div class="docstring">
2517
+ <div class="discussion">
2518
+
2519
+ <p>Return a new <code>Array</code> containing the values corresponding to the given keys.</p>
2520
+
2521
+
2522
+ </div>
2523
+ </div>
2524
+ <div class="tags">
2525
+
2526
+
2527
+ </div><table class="source_code">
2528
+ <tr>
2529
+ <td>
2530
+ <pre class="lines">
2531
+
2532
+
2533
+ 312
2534
+ 313
2535
+ 314</pre>
2536
+ </td>
2537
+ <td>
2538
+ <pre class="code"><span class="info file"># File 'lib/internal_lite3/dbm.rb', line 312</span>
2539
+
2540
+ <span class='kw'>def</span> <span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</span>
2541
+ <span class='kw'>return</span> <span class='id identifier rubyid_keys'>keys</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_k'>k</span><span class='op'>|</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
2542
+ <span class='kw'>end</span></pre>
2543
+ </td>
2544
+ </tr>
2545
+ </table>
2546
+ </div>
2547
+
2548
+ </div>
2549
+
2550
+ </div>
2551
+
2552
+ <div id="footer">
2553
+ Generated on Wed Mar 8 13:02:55 2023 by
2554
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2555
+ 0.9.26 (ruby-3.0.1).
2556
+ </div>
2557
+
2558
+ </div>
2559
+ </body>
2560
+ </html>