dbmlite3 1.0.a5 → 1.0.b1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7697155e6f50eba81b90d74a4fbf18e8fbcbf0d5058f809a88937a13e4e0f16d
4
- data.tar.gz: 9bb6679468e6d9c60df4dc5f0e90a43babc3a910bdb0145d8663d9664ab542f4
3
+ metadata.gz: 39c4154795b23715473f861838619458c749ce46a9c5e30abfecde4dee406554
4
+ data.tar.gz: efb8323e84cd7b7b45afdbe8c5b8e5611d8ebd8aa315796ea9e7e65341fdac85
5
5
  SHA512:
6
- metadata.gz: a9b0750ce7d670c1103ed74da2293d60589b61adcf81fcd3ea26c351e3e5a6810b42c4e8c1d26cafc9abcb6f96b8074f545f0bdbe129e7d0e97fb8a75f2155e3
7
- data.tar.gz: 7aac44f9d3ca015220dc46525b58b1338e71e7873956b5f2a1feb99bfd118ad46b3e28e4134c75234a37e7f58fb6d3ffb6d8d936c6db868b4eb68efd3f5d918a
6
+ metadata.gz: 118cb508287926fd7850b832c130468275cac2f4a56a8ca889d3e82255882f196653026059e94b474d43cfdfadbbb0e45ca9cc68681440ee08c7782ef4e80896
7
+ data.tar.gz: 31f04ecd6da0d00d684e483c19276425a0b05db40d40e2bcabc8bff69e3da1bb9a6efa452472f3153992cf0c0b4d587b35c0e69e9a34e154ce616721a75f41b9
data/README.md CHANGED
@@ -102,6 +102,15 @@ If you need to do a large number of accesses in a short amount of
102
102
  time (e.g. loading data from a file), it is significantly faster to
103
103
  do these in batches in one or more transactions.
104
104
 
105
+ ### Serialization Safety
106
+
107
+ `Lite3::DBM` stores Ruby data by first serializing values using the
108
+ `Marshal` or `Psych` modules. This can pose a security risk if an
109
+ untrusted third party has direct access to the underlying SQLite3
110
+ database. This tends to be pretty rare for most use-cases but if it
111
+ is a concern, you can always configure `Lite3::DBM` to store its
112
+ values as plain strings.
113
+
105
114
  ### Forking safely
106
115
 
107
116
  It is a documented limitation of SQLite3 that database objects
data/dbmlite3.gemspec CHANGED
@@ -1,9 +1,7 @@
1
1
 
2
- # Skeleton gemspec
3
-
4
2
  Gem::Specification.new do |s|
5
3
  s.name = 'dbmlite3'
6
- s.version = '1.0.a5'
4
+ s.version = '1.0.b1'
7
5
  s.date = '2022-02-21'
8
6
  s.summary = "A DBM-style key-value store using SQLite3"
9
7
  s.description = <<-EOF
@@ -26,14 +24,14 @@ EOF
26
24
  Dir.glob('doc/**/*') +
27
25
  Dir.glob('{spec,lib}/*.rb')
28
26
 
29
- s.required_ruby_version = '>= 2.7.0'
30
- s.requirements << "sqlite3, the usual devtools"
27
+ s.required_ruby_version = '>= 2.2.0'
28
+ s.requirements << "sqlite3 gem, Ruby MRI (required by sqlite3)"
31
29
 
32
30
  s.add_runtime_dependency "sqlite3", '~> 1.4'
33
31
 
34
32
  s.add_development_dependency "rspec", '~> 3.10', '>= 3.10.0'
35
33
  s.add_development_dependency "yard", '~> 0.9.25', '>= 0.9.25'
36
34
 
37
- s.homepage = 'https://codeberg.org/suetanvil/dbmlite'
35
+ s.homepage = 'https://codeberg.org/suetanvil/dbmlite3'
38
36
  s.license = 'MIT'
39
37
  end
data/doc/Lite3/DBM.html CHANGED
@@ -144,9 +144,15 @@ string. you will need to do this instead:</p>
144
144
  <p>Unlike DBM, values may (optionally) be any serializable Ruby type.</p>
145
145
 
146
146
  <p>You can select the serialization method with an optional third
147
- constructor argument. Options are <code>YAML</code> (the default), <code>Marshal</code>
148
- or simple string conversion with <code>to_s</code>. Each of these methods will
149
- have their own pros and cons.</p>
147
+ constructor argument. Options are YAML (the default), <code>Marshal</code>
148
+ or simple string conversion with <code>to_s</code>. Each of these methods
149
+ will have their own pros and cons.</p>
150
+
151
+ <p><strong>WARNING:</strong> Both YAML and Marshal serialization have the usual
152
+ security caveats as described in the documentation for <code>Marshal</code>
153
+ and <code>Psych</code>. If you are going to let an untrusted entity modify
154
+ the database, you should not use these methods and instead stick
155
+ to string conversion.</p>
150
156
 
151
157
  <p>The table name must be a valid name identifier (i.e. matches
152
158
  /^[a-zA-Z_]\w*$/).</p>
@@ -912,16 +918,17 @@ serialization method for converting Ruby values into storable
912
918
  strings. There are three options:</p>
913
919
 
914
920
  <ul>
915
- <li><code>:yaml</code> uses the <code>YAML</code> module.</li>
921
+ <li><code>:yaml</code> uses the <code>Psych</code> module.</li>
916
922
  <li><code>:marshal</code> uses the <code>Marshal</code> module.</li>
917
923
  <li><code>:string</code> simply uses the default <code>to_s</code> method, just like the
918
924
  stock <code>DBM</code>.</li>
919
925
  </ul>
920
926
 
921
927
  <p>Each of these will have their pros and cons. The default is
922
- <code>:yaml</code> because that is the most portable across Ruby versions.
923
- <code>:marshal</code> tends to be faster but is not stable across Ruby
924
- versions. Note that <code>DBM</code> does not check your Marshal version.</p>
928
+ <code>:yaml</code> because that is the most portable. <code>:marshal</code> tends to
929
+ be faster but is incompatible across minor Ruby versions.</p>
930
+
931
+ <p>(Note that <code>DBM</code> does not check your Marshal version.)</p>
925
932
 
926
933
  <p>Your serializer choice is registered in a metadata table when
927
934
  <code>tablename</code> is created in the SQLite3 file. Afterward, it is an
@@ -940,13 +947,6 @@ and will result in a Lite3::Error exception.</p>
940
947
  <pre class="lines">
941
948
 
942
949
 
943
- 409
944
- 410
945
- 411
946
- 412
947
- 413
948
- 414
949
- 415
950
950
  416
951
951
  417
952
952
  418
@@ -960,10 +960,17 @@ and will result in a Lite3::Error exception.</p>
960
960
  426
961
961
  427
962
962
  428
963
- 429</pre>
963
+ 429
964
+ 430
965
+ 431
966
+ 432
967
+ 433
968
+ 434
969
+ 435
970
+ 436</pre>
964
971
  </td>
965
972
  <td>
966
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 409</span>
973
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 416</span>
967
974
 
968
975
  <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>
969
976
  <span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
@@ -1025,19 +1032,19 @@ This is analagous to <code>File.open</code>.</p>
1025
1032
  <pre class="lines">
1026
1033
 
1027
1034
 
1028
- 435
1029
- 436
1030
- 437
1031
- 438
1032
- 439
1033
- 440
1034
- 441
1035
1035
  442
1036
1036
  443
1037
- 444</pre>
1037
+ 444
1038
+ 445
1039
+ 446
1040
+ 447
1041
+ 448
1042
+ 449
1043
+ 450
1044
+ 451</pre>
1038
1045
  </td>
1039
1046
  <td>
1040
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 435</span>
1047
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 442</span>
1041
1048
 
1042
1049
  <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>
1043
1050
  <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>
@@ -1086,12 +1093,12 @@ nil if it is not present.</p>
1086
1093
  <pre class="lines">
1087
1094
 
1088
1095
 
1089
- 644
1090
- 645
1091
- 646</pre>
1096
+ 662
1097
+ 663
1098
+ 664</pre>
1092
1099
  </td>
1093
1100
  <td>
1094
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 644</span>
1101
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 662</span>
1095
1102
 
1096
1103
  <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>
1097
1104
  <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>
@@ -1135,24 +1142,6 @@ serialization method you have chosen.</p>
1135
1142
  <pre class="lines">
1136
1143
 
1137
1144
 
1138
- 597
1139
- 598
1140
- 599
1141
- 600
1142
- 601
1143
- 602
1144
- 603
1145
- 604
1146
- 605
1147
- 606
1148
- 607
1149
- 608
1150
- 609
1151
- 610
1152
- 611
1153
- 612
1154
- 613
1155
- 614
1156
1145
  615
1157
1146
  616
1158
1147
  617
@@ -1177,10 +1166,28 @@ serialization method you have chosen.</p>
1177
1166
  636
1178
1167
  637
1179
1168
  638
1180
- 639</pre>
1169
+ 639
1170
+ 640
1171
+ 641
1172
+ 642
1173
+ 643
1174
+ 644
1175
+ 645
1176
+ 646
1177
+ 647
1178
+ 648
1179
+ 649
1180
+ 650
1181
+ 651
1182
+ 652
1183
+ 653
1184
+ 654
1185
+ 655
1186
+ 656
1187
+ 657</pre>
1181
1188
  </td>
1182
1189
  <td>
1183
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 597</span>
1190
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 615</span>
1184
1191
 
1185
1192
  <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>
1186
1193
  <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>
@@ -1255,12 +1262,12 @@ serialization method you have chosen.</p>
1255
1262
  <pre class="lines">
1256
1263
 
1257
1264
 
1258
- 728
1259
- 729
1260
- 730</pre>
1265
+ 746
1266
+ 747
1267
+ 748</pre>
1261
1268
  </td>
1262
1269
  <td>
1263
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 728</span>
1270
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 746</span>
1264
1271
 
1265
1272
  <span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
1266
1273
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>delete from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
@@ -1300,13 +1307,13 @@ no other <code>DBM</code> objects using that file.</p>
1300
1307
  <pre class="lines">
1301
1308
 
1302
1309
 
1303
- 532
1304
- 533
1305
- 534
1306
- 535</pre>
1310
+ 550
1311
+ 551
1312
+ 552
1313
+ 553</pre>
1307
1314
  </td>
1308
1315
  <td>
1309
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 532</span>
1316
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 550</span>
1310
1317
 
1311
1318
  <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
1312
1319
  <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>
@@ -1356,12 +1363,12 @@ closed <code>DBM</code>.</p>
1356
1363
  <pre class="lines">
1357
1364
 
1358
1365
 
1359
- 539
1360
- 540
1361
- 541</pre>
1366
+ 557
1367
+ 558
1368
+ 559</pre>
1362
1369
  </td>
1363
1370
  <td>
1364
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 539</span>
1371
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 557</span>
1365
1372
 
1366
1373
  <span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span><span class='lparen'>(</span><span class='rparen'>)</span>
1367
1374
  <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>
@@ -1397,14 +1404,14 @@ not present, does nothing.</p>
1397
1404
  <pre class="lines">
1398
1405
 
1399
1406
 
1400
- 817
1401
- 818
1402
- 819
1403
- 820
1404
- 821</pre>
1407
+ 835
1408
+ 836
1409
+ 837
1410
+ 838
1411
+ 839</pre>
1405
1412
  </td>
1406
1413
  <td>
1407
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 817</span>
1414
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 835</span>
1408
1415
 
1409
1416
  <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>
1410
1417
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -1463,14 +1470,14 @@ each entry for which the block returns true.</p>
1463
1470
  <pre class="lines">
1464
1471
 
1465
1472
 
1466
- 827
1467
- 828
1468
- 829
1469
- 830
1470
- 831</pre>
1473
+ 845
1474
+ 846
1475
+ 847
1476
+ 848
1477
+ 849</pre>
1471
1478
  </td>
1472
1479
  <td>
1473
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 827</span>
1480
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 845</span>
1474
1481
 
1475
1482
  <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>
1476
1483
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -1535,14 +1542,14 @@ own transaction.</p>
1535
1542
  <pre class="lines">
1536
1543
 
1537
1544
 
1538
- 742
1539
- 743
1540
- 744
1541
- 745
1542
- 746</pre>
1545
+ 760
1546
+ 761
1547
+ 762
1548
+ 763
1549
+ 764</pre>
1543
1550
  </td>
1544
1551
  <td>
1545
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 742</span>
1552
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 760</span>
1546
1553
 
1547
1554
  <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>
1548
1555
  <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>
@@ -1597,13 +1604,13 @@ own transaction.</p>
1597
1604
  <pre class="lines">
1598
1605
 
1599
1606
 
1600
- 792
1601
- 793
1602
- 794
1603
- 795</pre>
1607
+ 810
1608
+ 811
1609
+ 812
1610
+ 813</pre>
1604
1611
  </td>
1605
1612
  <td>
1606
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 792</span>
1613
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 810</span>
1607
1614
 
1608
1615
  <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>
1609
1616
  <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>
@@ -1657,13 +1664,13 @@ own transaction.</p>
1657
1664
  <pre class="lines">
1658
1665
 
1659
1666
 
1660
- 801
1661
- 802
1662
- 803
1663
- 804</pre>
1667
+ 819
1668
+ 820
1669
+ 821
1670
+ 822</pre>
1664
1671
  </td>
1665
1672
  <td>
1666
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 801</span>
1673
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 819</span>
1667
1674
 
1668
1675
  <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>
1669
1676
  <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>
@@ -1712,12 +1719,12 @@ own transaction.</p>
1712
1719
  <pre class="lines">
1713
1720
 
1714
1721
 
1715
- 844
1716
- 845
1717
- 846</pre>
1722
+ 862
1723
+ 863
1724
+ 864</pre>
1718
1725
  </td>
1719
1726
  <td>
1720
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 844</span>
1727
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 862</span>
1721
1728
 
1722
1729
  <span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
1723
1730
  <span class='kw'>return</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>0</span>
@@ -1793,24 +1800,6 @@ exception.</p>
1793
1800
  <pre class="lines">
1794
1801
 
1795
1802
 
1796
- 662
1797
- 663
1798
- 664
1799
- 665
1800
- 666
1801
- 667
1802
- 668
1803
- 669
1804
- 670
1805
- 671
1806
- 672
1807
- 673
1808
- 674
1809
- 675
1810
- 676
1811
- 677
1812
- 678
1813
- 679
1814
1803
  680
1815
1804
  681
1816
1805
  682
@@ -1819,10 +1808,28 @@ exception.</p>
1819
1808
  685
1820
1809
  686
1821
1810
  687
1822
- 688</pre>
1811
+ 688
1812
+ 689
1813
+ 690
1814
+ 691
1815
+ 692
1816
+ 693
1817
+ 694
1818
+ 695
1819
+ 696
1820
+ 697
1821
+ 698
1822
+ 699
1823
+ 700
1824
+ 701
1825
+ 702
1826
+ 703
1827
+ 704
1828
+ 705
1829
+ 706</pre>
1823
1830
  </td>
1824
1831
  <td>
1825
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 662</span>
1832
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 680</span>
1826
1833
 
1827
1834
  <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>
1828
1835
 
@@ -1898,12 +1905,12 @@ to help with unit tests.</p>
1898
1905
  <pre class="lines">
1899
1906
 
1900
1907
 
1901
- 548
1902
- 549
1903
- 550</pre>
1908
+ 566
1909
+ 567
1910
+ 568</pre>
1904
1911
  </td>
1905
1912
  <td>
1906
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 548</span>
1913
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 566</span>
1907
1914
 
1908
1915
  <span class='kw'>def</span> <span class='id identifier rubyid_handle_closed?'>handle_closed?</span>
1909
1916
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
@@ -1956,14 +1963,14 @@ to help with unit tests.</p>
1956
1963
  <pre class="lines">
1957
1964
 
1958
1965
 
1959
- 718
1960
- 719
1961
- 720
1962
- 721
1963
- 722</pre>
1966
+ 736
1967
+ 737
1968
+ 738
1969
+ 739
1970
+ 740</pre>
1964
1971
  </td>
1965
1972
  <td>
1966
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 718</span>
1973
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 736</span>
1967
1974
 
1968
1975
  <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>
1969
1976
  <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>
@@ -2019,13 +2026,13 @@ to help with unit tests.</p>
2019
2026
  <pre class="lines">
2020
2027
 
2021
2028
 
2022
- 887
2023
- 888
2024
- 889
2025
- 890</pre>
2029
+ 905
2030
+ 906
2031
+ 907
2032
+ 908</pre>
2026
2033
  </td>
2027
2034
  <td>
2028
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 887</span>
2035
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 905</span>
2029
2036
 
2030
2037
  <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>
2031
2038
  <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='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>
@@ -2066,14 +2073,14 @@ program.</p>
2066
2073
  <pre class="lines">
2067
2074
 
2068
2075
 
2069
- 899
2070
- 900
2071
- 901
2072
- 902
2073
- 903</pre>
2076
+ 917
2077
+ 918
2078
+ 919
2079
+ 920
2080
+ 921</pre>
2074
2081
  </td>
2075
2082
  <td>
2076
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 899</span>
2083
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 917</span>
2077
2084
 
2078
2085
  <span class='kw'>def</span> <span class='id identifier rubyid_invert'>invert</span>
2079
2086
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -2113,14 +2120,14 @@ that the result could exceed available memory.</p>
2113
2120
  <pre class="lines">
2114
2121
 
2115
2122
 
2116
- 700
2117
- 701
2118
- 702
2119
- 703
2120
- 704</pre>
2123
+ 718
2124
+ 719
2125
+ 720
2126
+ 721
2127
+ 722</pre>
2121
2128
  </td>
2122
2129
  <td>
2123
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 700</span>
2130
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 718</span>
2124
2131
 
2125
2132
  <span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
2126
2133
  <span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2159,19 +2166,19 @@ as determined by SQLite3.</p>
2159
2166
  <pre class="lines">
2160
2167
 
2161
2168
 
2162
- 908
2163
- 909
2164
- 910
2165
- 911
2166
- 912
2167
- 913
2168
- 914
2169
- 915
2170
- 916
2171
- 917</pre>
2169
+ 926
2170
+ 927
2171
+ 928
2172
+ 929
2173
+ 930
2174
+ 931
2175
+ 932
2176
+ 933
2177
+ 934
2178
+ 935</pre>
2172
2179
  </td>
2173
2180
  <td>
2174
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 908</span>
2181
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 926</span>
2175
2182
 
2176
2183
  <span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span>
2177
2184
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -2217,15 +2224,15 @@ as determined by SQLite3.</p>
2217
2224
  <pre class="lines">
2218
2225
 
2219
2226
 
2220
- 835
2221
- 836
2222
- 837
2223
- 838
2224
- 839
2225
- 840</pre>
2227
+ 853
2228
+ 854
2229
+ 855
2230
+ 856
2231
+ 857
2232
+ 858</pre>
2226
2233
  </td>
2227
2234
  <td>
2228
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 835</span>
2235
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 853</span>
2229
2236
 
2230
2237
  <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
2231
2238
  <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>select count(*) from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</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>
@@ -2268,14 +2275,14 @@ program.</p>
2268
2275
  <pre class="lines">
2269
2276
 
2270
2277
 
2271
- 872
2272
- 873
2273
- 874
2274
- 875
2275
- 876</pre>
2278
+ 890
2279
+ 891
2280
+ 892
2281
+ 893
2282
+ 894</pre>
2276
2283
  </td>
2277
2284
  <td>
2278
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 872</span>
2285
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 890</span>
2279
2286
 
2280
2287
  <span class='kw'>def</span> <span class='id identifier rubyid_to_a'>to_a</span>
2281
2288
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2316,14 +2323,14 @@ program.</p>
2316
2323
  <pre class="lines">
2317
2324
 
2318
2325
 
2319
- 859
2320
- 860
2321
- 861
2322
- 862
2323
- 863</pre>
2326
+ 877
2327
+ 878
2328
+ 879
2329
+ 880
2330
+ 881</pre>
2324
2331
  </td>
2325
2332
  <td>
2326
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 859</span>
2333
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 877</span>
2327
2334
 
2328
2335
  <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span>
2329
2336
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -2354,14 +2361,14 @@ program.</p>
2354
2361
  <pre class="lines">
2355
2362
 
2356
2363
 
2357
- 519
2358
- 520
2359
- 521
2360
- 522
2361
- 523</pre>
2364
+ 537
2365
+ 538
2366
+ 539
2367
+ 540
2368
+ 541</pre>
2362
2369
  </td>
2363
2370
  <td>
2364
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 519</span>
2371
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 537</span>
2365
2372
 
2366
2373
  <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
2367
2374
  <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>
@@ -2429,12 +2436,12 @@ argument.</p>
2429
2436
  <pre class="lines">
2430
2437
 
2431
2438
 
2432
- 576
2433
- 577
2434
- 578</pre>
2439
+ 594
2440
+ 595
2441
+ 596</pre>
2435
2442
  </td>
2436
2443
  <td>
2437
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 576</span>
2444
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 594</span>
2438
2445
 
2439
2446
  <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>
2440
2447
  <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>
@@ -2482,12 +2489,12 @@ argument.</p>
2482
2489
  <pre class="lines">
2483
2490
 
2484
2491
 
2485
- 581
2486
- 582
2487
- 583</pre>
2492
+ 599
2493
+ 600
2494
+ 601</pre>
2488
2495
  </td>
2489
2496
  <td>
2490
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 581</span>
2497
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 599</span>
2491
2498
 
2492
2499
  <span class='kw'>def</span> <span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
2493
2500
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
@@ -2524,14 +2531,14 @@ including <code>Hash</code> and <code>DBM</code> objects.</p>
2524
2531
  <pre class="lines">
2525
2532
 
2526
2533
 
2527
- 809
2528
- 810
2529
- 811
2530
- 812
2531
- 813</pre>
2534
+ 827
2535
+ 828
2536
+ 829
2537
+ 830
2538
+ 831</pre>
2532
2539
  </td>
2533
2540
  <td>
2534
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 809</span>
2541
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 827</span>
2535
2542
 
2536
2543
  <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>
2537
2544
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -2571,14 +2578,14 @@ that the result could exceed available memory.</p>
2571
2578
  <pre class="lines">
2572
2579
 
2573
2580
 
2574
- 710
2575
- 711
2576
- 712
2577
- 713
2578
- 714</pre>
2581
+ 728
2582
+ 729
2583
+ 730
2584
+ 731
2585
+ 732</pre>
2579
2586
  </td>
2580
2587
  <td>
2581
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 710</span>
2588
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 728</span>
2582
2589
 
2583
2590
  <span class='kw'>def</span> <span class='id identifier rubyid_values'>values</span>
2584
2591
  <span class='id identifier rubyid_values'>values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2616,12 +2623,12 @@ given keys.</p>
2616
2623
  <pre class="lines">
2617
2624
 
2618
2625
 
2619
- 692
2620
- 693
2621
- 694</pre>
2626
+ 710
2627
+ 711
2628
+ 712</pre>
2622
2629
  </td>
2623
2630
  <td>
2624
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 692</span>
2631
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 710</span>
2625
2632
 
2626
2633
  <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>
2627
2634
  <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>
@@ -2636,7 +2643,7 @@ given keys.</p>
2636
2643
  </div>
2637
2644
 
2638
2645
  <div id="footer">
2639
- Generated on Sat Feb 26 11:47:57 2022 by
2646
+ Generated on Sun Feb 27 17:39:45 2022 by
2640
2647
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2641
2648
  0.9.25 (ruby-2.7.0).
2642
2649
  </div>
data/doc/Lite3/Error.html CHANGED
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Sat Feb 26 11:47:56 2022 by
128
+ Generated on Sun Feb 27 17:39:45 2022 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.25 (ruby-2.7.0).
131
131
  </div>
data/doc/Lite3/SQL.html CHANGED
@@ -380,7 +380,7 @@ thread safe. Just a wrapper around <code>SQLite3.threadsafe?</code></p>
380
380
  </div>
381
381
 
382
382
  <div id="footer">
383
- Generated on Sat Feb 26 11:47:56 2022 by
383
+ Generated on Sun Feb 27 17:39:45 2022 by
384
384
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
385
385
  0.9.25 (ruby-2.7.0).
386
386
  </div>
data/doc/Lite3.html CHANGED
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Sat Feb 26 11:47:56 2022 by
110
+ Generated on Sun Feb 27 17:39:45 2022 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.9.25 (ruby-2.7.0).
113
113
  </div>
data/doc/_index.html CHANGED
@@ -142,7 +142,7 @@
142
142
  </div>
143
143
 
144
144
  <div id="footer">
145
- Generated on Sat Feb 26 11:47:56 2022 by
145
+ Generated on Sun Feb 27 17:39:45 2022 by
146
146
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
147
  0.9.25 (ruby-2.7.0).
148
148
  </div>
data/doc/file.README.html CHANGED
@@ -163,6 +163,15 @@ only one program accesses the table at a time.</p>
163
163
  time (e.g. loading data from a file), it is significantly faster to
164
164
  do these in batches in one or more transactions.</p>
165
165
 
166
+ <h3 id="serialization-safety">Serialization Safety</h3>
167
+
168
+ <p><code>Lite3::DBM</code> stores Ruby data by first serializing values using the
169
+ <code>Marshal</code> or <code>Psych</code> modules. This can pose a security risk if an
170
+ untrusted third party has direct access to the underlying SQLite3
171
+ database. This tends to be pretty rare for most use-cases but if it
172
+ is a concern, you can always configure <code>Lite3::DBM</code> to store its
173
+ values as plain strings.</p>
174
+
166
175
  <h3 id="forking-safely">Forking safely</h3>
167
176
 
168
177
  <p>It is a documented limitation of SQLite3 that database objects
@@ -193,7 +202,7 @@ make sense of them.</p>
193
202
  </div></div>
194
203
 
195
204
  <div id="footer">
196
- Generated on Sat Feb 26 11:47:56 2022 by
205
+ Generated on Sun Feb 27 17:39:45 2022 by
197
206
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
207
  0.9.25 (ruby-2.7.0).
199
208
  </div>
data/doc/index.html CHANGED
@@ -163,6 +163,15 @@ only one program accesses the table at a time.</p>
163
163
  time (e.g. loading data from a file), it is significantly faster to
164
164
  do these in batches in one or more transactions.</p>
165
165
 
166
+ <h3 id="serialization-safety">Serialization Safety</h3>
167
+
168
+ <p><code>Lite3::DBM</code> stores Ruby data by first serializing values using the
169
+ <code>Marshal</code> or <code>Psych</code> modules. This can pose a security risk if an
170
+ untrusted third party has direct access to the underlying SQLite3
171
+ database. This tends to be pretty rare for most use-cases but if it
172
+ is a concern, you can always configure <code>Lite3::DBM</code> to store its
173
+ values as plain strings.</p>
174
+
166
175
  <h3 id="forking-safely">Forking safely</h3>
167
176
 
168
177
  <p>It is a documented limitation of SQLite3 that database objects
@@ -193,7 +202,7 @@ make sense of them.</p>
193
202
  </div></div>
194
203
 
195
204
  <div id="footer">
196
- Generated on Sat Feb 26 11:47:56 2022 by
205
+ Generated on Sun Feb 27 17:39:45 2022 by
197
206
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
207
  0.9.25 (ruby-2.7.0).
199
208
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sat Feb 26 11:47:56 2022 by
103
+ Generated on Sun Feb 27 17:39:45 2022 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.25 (ruby-2.7.0).
106
106
  </div>
data/lib/dbmlite3.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  gem "sqlite3", "~> 1.4"
3
3
 
4
4
  require 'sqlite3'
5
- require 'yaml'
5
+ require 'psych'
6
6
  require 'set'
7
7
 
8
8
 
@@ -344,9 +344,15 @@ module Lite3
344
344
  # Unlike DBM, values may (optionally) be any serializable Ruby type.
345
345
  #
346
346
  # You can select the serialization method with an optional third
347
- # constructor argument. Options are `YAML` (the default), `Marshal`
348
- # or simple string conversion with `to_s`. Each of these methods will
349
- # have their own pros and cons.
347
+ # constructor argument. Options are YAML (the default), `Marshal`
348
+ # or simple string conversion with `to_s`. Each of these methods
349
+ # will have their own pros and cons.
350
+ #
351
+ # **WARNING:** Both YAML and Marshal serialization have the usual
352
+ # security caveats as described in the documentation for `Marshal`
353
+ # and `Psych`. If you are going to let an untrusted entity modify
354
+ # the database, you should not use these methods and instead stick
355
+ # to string conversion.
350
356
  #
351
357
  # The table name must be a valid name identifier (i.e. matches
352
358
  # /^[a-zA-Z_]\w*$/).
@@ -391,15 +397,16 @@ module Lite3
391
397
  # serialization method for converting Ruby values into storable
392
398
  # strings. There are three options:
393
399
  #
394
- # * `:yaml` uses the `YAML` module.
400
+ # * `:yaml` uses the `Psych` module.
395
401
  # * `:marshal` uses the `Marshal` module.
396
402
  # * `:string` simply uses the default `to_s` method, just like the
397
403
  # stock `DBM`.
398
404
  #
399
405
  # Each of these will have their pros and cons. The default is
400
- # `:yaml` because that is the most portable across Ruby versions.
401
- # `:marshal` tends to be faster but is not stable across Ruby
402
- # versions. Note that `DBM` does not check your Marshal version.
406
+ # `:yaml` because that is the most portable. `:marshal` tends to
407
+ # be faster but is incompatible across minor Ruby versions.
408
+ #
409
+ # (Note that `DBM` does not check your Marshal version.)
403
410
  #
404
411
  # Your serializer choice is registered in a metadata table when
405
412
  # `tablename` is created in the SQLite3 file. Afterward, it is an
@@ -450,8 +457,19 @@ module Lite3
450
457
  def value_encoders(serializer)
451
458
  case serializer
452
459
  when :yaml
453
- enc = proc{ |val| YAML.dump(val) }
454
- dec = proc{ |val| YAML.load(val) }
460
+ enc = proc{ |val| Psych.dump(val) }
461
+
462
+ # Psych (and module YAML) has gradually moved from defaulting
463
+ # from unsafe loading to safe loading. This is a pain for us
464
+ # because old versions don't provide `unsafe_load` as an alias
465
+ # to `load` and new versions default `load` to `safe_load`.
466
+ # So we have to do this thing to pick `unsafe_load` if it's
467
+ # available and `load` otherwise.
468
+ if Psych.respond_to? :unsafe_load
469
+ dec = proc{ |val| Psych.unsafe_load(val) }
470
+ else
471
+ dec = proc{ |val| Psych.load(val) }
472
+ end
455
473
 
456
474
  when :marshal
457
475
  enc = proc { |val| Marshal.dump(val) }
@@ -957,15 +957,12 @@ describe Lite3::SQL do
957
957
  expect( db1.closed? ) .to be true
958
958
  expect( db1.to_s.class ) .to be String
959
959
 
960
- # Everything else shoudl raise an error
960
+ # Everything else should raise an error
961
961
  expect{ db1["foo"] } .to raise_error Lite3::Error
962
962
  expect{ db1["foo"] = 42 } .to raise_error Lite3::Error
963
963
  expect{ db1.each{} } .to raise_error Lite3::Error
964
964
  expect{ db1.size } .to raise_error Lite3::Error
965
965
  expect{ db1.to_a } .to raise_error Lite3::Error
966
-
967
- # Ensure we haven't accidentally overridded superclass methods.
968
- expect( db1.object_id.class ) .to be Integer
969
966
  end
970
967
  end
971
968
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbmlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.a5
4
+ version: 1.0.b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Reuter
@@ -104,7 +104,7 @@ files:
104
104
  - lib/dbmlite3.rb
105
105
  - spec/dbmlite3_spec.rb
106
106
  - spec/spec_helper.rb
107
- homepage: https://codeberg.org/suetanvil/dbmlite
107
+ homepage: https://codeberg.org/suetanvil/dbmlite3
108
108
  licenses:
109
109
  - MIT
110
110
  metadata: {}
@@ -116,14 +116,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 2.7.0
119
+ version: 2.2.0
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.3.1
125
125
  requirements:
126
- - sqlite3, the usual devtools
126
+ - sqlite3 gem, Ruby MRI (required by sqlite3)
127
127
  rubygems_version: 3.1.2
128
128
  signing_key:
129
129
  specification_version: 4