type_toolkit 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -1
  3. data/benchmark/.rubocop.yml +7 -0
  4. data/benchmark/abstract_methods_benchmark.rb +221 -0
  5. data/benchmark/interface_startup_performance.rb +128 -0
  6. data/benchmark/module_benchmark.rb +62 -0
  7. data/config/default.yml +5 -0
  8. data/docs/design/inherited_implementation_problem.md +119 -0
  9. data/docs/design/self_dot_methods.md +79 -0
  10. data/lib/rubocop/cop/type_toolkit/plugin.rb +2 -1
  11. data/lib/rubocop/cop/type_toolkit/prefer_not_nil.rb +96 -0
  12. data/lib/rubocop-type_toolkit.rb +1 -0
  13. data/lib/type_toolkit/abstract_method_receiver.rb +39 -0
  14. data/lib/type_toolkit/dsl.rb +64 -0
  15. data/lib/type_toolkit/ext/method.rb +11 -0
  16. data/lib/type_toolkit/ext/module.rb +7 -0
  17. data/lib/type_toolkit/ext/nil_assertions.rb +3 -1
  18. data/lib/type_toolkit/has_abstract_methods.rb +108 -0
  19. data/lib/type_toolkit/interface.rb +38 -0
  20. data/lib/type_toolkit/method_def_recorder.rb +53 -0
  21. data/lib/type_toolkit/method_patch.rb +16 -0
  22. data/lib/type_toolkit/version.rb +1 -1
  23. data/lib/type_toolkit.rb +3 -0
  24. data/sorbet/config +3 -1
  25. data/sorbet/rbi/gems/benchmark-ips@2.14.0.rbi +981 -0
  26. data/sorbet/rbi/gems/{erb@6.0.1.rbi → erb@6.0.1.1.rbi} +2 -2
  27. data/sorbet/rbi/gems/{json@2.18.1.rbi → json@2.19.9.rbi} +115 -161
  28. data/sorbet/rbi/gems/minitest@5.27.0.rbi +707 -0
  29. data/sorbet/rbi/gems/rexml@3.4.4.rbi +0 -167
  30. data/sorbet/rbi/gems/rubocop-ast@1.49.0.rbi +6 -0
  31. data/sorbet/rbi/gems/rubocop@1.84.2.rbi +7 -0
  32. data/sorbet/rbi/gems/tapioca@0.17.10.rbi +1 -0
  33. data/sorbet/rbi/gems/{yard@0.9.38.rbi → yard@0.9.44.rbi} +1206 -241
  34. data/sorbet/rbi/shims/core.rbi +19 -0
  35. data/sorbet/rbi/shims/minitest.rbi +5 -2
  36. data/spec/interface_spec.rb +405 -0
  37. data/spec/rubocop/cop/type_toolkit/prefer_not_nil_spec.rb +229 -0
  38. data/spec/spec_helper.rb +14 -0
  39. metadata +23 -4
@@ -5,28 +5,6 @@
5
5
  # Please instead update this file by running `bin/tapioca gem json`.
6
6
 
7
7
 
8
- class Array
9
- include ::Enumerable
10
- include ::JSON::Ext::Generator::GeneratorMethods::Array
11
- end
12
-
13
- class FalseClass
14
- include ::JSON::Ext::Generator::GeneratorMethods::FalseClass
15
- end
16
-
17
- class Float < ::Numeric
18
- include ::JSON::Ext::Generator::GeneratorMethods::Float
19
- end
20
-
21
- class Hash
22
- include ::Enumerable
23
- include ::JSON::Ext::Generator::GeneratorMethods::Hash
24
- end
25
-
26
- class Integer < ::Numeric
27
- include ::JSON::Ext::Generator::GeneratorMethods::Integer
28
- end
29
-
30
8
  # = JavaScript \Object Notation (\JSON)
31
9
  #
32
10
  # \JSON is a lightweight data-interchange format.
@@ -219,6 +197,18 @@ end
219
197
  # When enabled:
220
198
  # JSON.parse(%{"Hello\nWorld"}, allow_control_characters: true) # => "Hello\nWorld"
221
199
  #
200
+ # ---
201
+ #
202
+ # Option +allow_invalid_escape+ (boolean) specifies whether to ignore backslahes that are followed
203
+ # by an invalid escape character in strings;
204
+ # defaults to +false+.
205
+ #
206
+ # With the default, +false+:
207
+ # JSON.parse('"Hell\o"') # invalid escape character in string (JSON::ParserError)
208
+ #
209
+ # When enabled:
210
+ # JSON.parse('"Hell\o"', allow_invalid_escape: true) # => "Hello"
211
+ #
222
212
  # ====== Output Options
223
213
  #
224
214
  # Option +freeze+ (boolean) specifies whether the returned objects will be frozen;
@@ -348,8 +338,8 @@ end
348
338
  # JSON.generate(JSON::MinusInfinity)
349
339
  #
350
340
  # Allow:
351
- # ruby = [Float::NaN, Float::Infinity, Float::MinusInfinity]
352
- # JSON.generate(ruby, allow_nan: true) # => '[NaN,Infinity,-Infinity]'
341
+ # ruby = [Float::NAN, Float::INFINITY, JSON::NaN, JSON::Infinity, JSON::MinusInfinity]
342
+ # JSON.generate(ruby, allow_nan: true) # => '[NaN,Infinity,NaN,Infinity,-Infinity]'
353
343
  #
354
344
  # ---
355
345
  #
@@ -714,7 +704,7 @@ module JSON
714
704
  # Output:
715
705
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
716
706
  #
717
- # source://json//lib/json/common.rb#930
707
+ # source://json//lib/json/common.rb#932
718
708
  def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
719
709
 
720
710
  # :call-seq:
@@ -731,10 +721,10 @@ module JSON
731
721
  # # Raises SystemStackError (stack level too deep):
732
722
  # JSON.fast_generate(a)
733
723
  #
734
- # source://json//lib/json/common.rb#460
724
+ # source://json//lib/json/common.rb#462
735
725
  def fast_generate(obj, opts = T.unsafe(nil)); end
736
726
 
737
- # source://json//lib/json/common.rb#975
727
+ # source://json//lib/json/common.rb#977
738
728
  def fast_unparse(*_arg0, **_arg1, &_arg2); end
739
729
 
740
730
  # :call-seq:
@@ -773,7 +763,7 @@ module JSON
773
763
  # # Raises JSON::NestingError (nesting of 100 is too deep):
774
764
  # JSON.generate(a)
775
765
  #
776
- # source://json//lib/json/common.rb#439
766
+ # source://json//lib/json/common.rb#441
777
767
  def generate(obj, opts = T.unsafe(nil)); end
778
768
 
779
769
  # :call-seq:
@@ -913,7 +903,7 @@ module JSON
913
903
  # #<Admin:0x00000000064c41f8
914
904
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
915
905
  #
916
- # source://json//lib/json/common.rb#854
906
+ # source://json//lib/json/common.rb#856
917
907
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
918
908
 
919
909
  # :call-seq:
@@ -924,7 +914,7 @@ module JSON
924
914
  #
925
915
  # See method #parse.
926
916
  #
927
- # source://json//lib/json/common.rb#388
917
+ # source://json//lib/json/common.rb#390
928
918
  def load_file(filespec, opts = T.unsafe(nil)); end
929
919
 
930
920
  # :call-seq:
@@ -935,7 +925,7 @@ module JSON
935
925
  #
936
926
  # See method #parse!
937
927
  #
938
- # source://json//lib/json/common.rb#399
928
+ # source://json//lib/json/common.rb#401
939
929
  def load_file!(filespec, opts = T.unsafe(nil)); end
940
930
 
941
931
  # :call-seq:
@@ -986,7 +976,7 @@ module JSON
986
976
  # # Raises JSON::ParserError (783: unexpected token at ''):
987
977
  # JSON.parse('')
988
978
  #
989
- # source://json//lib/json/common.rb#351
979
+ # source://json//lib/json/common.rb#353
990
980
  def parse(source, opts = T.unsafe(nil)); end
991
981
 
992
982
  # :call-seq:
@@ -1001,7 +991,7 @@ module JSON
1001
991
  # which disables checking for nesting depth.
1002
992
  # - Option +allow_nan+, if not provided, defaults to +true+.
1003
993
  #
1004
- # source://json//lib/json/common.rb#373
994
+ # source://json//lib/json/common.rb#375
1005
995
  def parse!(source, opts = T.unsafe(nil)); end
1006
996
 
1007
997
  # :call-seq:
@@ -1034,20 +1024,20 @@ module JSON
1034
1024
  # }
1035
1025
  # }
1036
1026
  #
1037
- # source://json//lib/json/common.rb#507
1027
+ # source://json//lib/json/common.rb#509
1038
1028
  def pretty_generate(obj, opts = T.unsafe(nil)); end
1039
1029
 
1040
- # source://json//lib/json/common.rb#985
1030
+ # source://json//lib/json/common.rb#987
1041
1031
  def pretty_unparse(*_arg0, **_arg1, &_arg2); end
1042
1032
 
1043
- # source://json//lib/json/common.rb#995
1033
+ # source://json//lib/json/common.rb#997
1044
1034
  def restore(*_arg0, **_arg1, &_arg2); end
1045
1035
 
1046
1036
  # :stopdoc:
1047
1037
  # All these were meant to be deprecated circa 2009, but were just set as undocumented
1048
1038
  # so usage still exist in the wild.
1049
1039
  #
1050
- # source://json//lib/json/common.rb#965
1040
+ # source://json//lib/json/common.rb#967
1051
1041
  def unparse(*_arg0, **_arg1, &_arg2); end
1052
1042
 
1053
1043
  # :call-seq:
@@ -1181,7 +1171,7 @@ module JSON
1181
1171
  # #<Admin:0x00000000064c41f8
1182
1172
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1183
1173
  #
1184
- # source://json//lib/json/common.rb#683
1174
+ # source://json//lib/json/common.rb#685
1185
1175
  def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1186
1176
 
1187
1177
  class << self
@@ -1200,26 +1190,26 @@ module JSON
1200
1190
  # source://json//lib/json/common.rb#132
1201
1191
  def [](object, opts = T.unsafe(nil)); end
1202
1192
 
1203
- # source://json//lib/json/common.rb#206
1193
+ # source://json//lib/json/common.rb#208
1204
1194
  def _dump_default_options; end
1205
1195
 
1206
- # source://json//lib/json/common.rb#206
1196
+ # source://json//lib/json/common.rb#208
1207
1197
  def _load_default_options; end
1208
1198
 
1209
- # source://json//lib/json/common.rb#206
1199
+ # source://json//lib/json/common.rb#208
1210
1200
  def _unsafe_load_default_options; end
1211
1201
 
1212
1202
  # Returns the current create identifier.
1213
1203
  # See also JSON.create_id=.
1214
1204
  #
1215
- # source://json//lib/json/common.rb#234
1205
+ # source://json//lib/json/common.rb#236
1216
1206
  def create_id; end
1217
1207
 
1218
1208
  # Sets create identifier, which is used to decide if the _json_create_
1219
1209
  # hook of a class should be called; initial value is +json_class+:
1220
1210
  # JSON.create_id # => 'json_class'
1221
1211
  #
1222
- # source://json//lib/json/common.rb#228
1212
+ # source://json//lib/json/common.rb#230
1223
1213
  def create_id=(new_value); end
1224
1214
 
1225
1215
  # source://json//lib/json/common.rb#104
@@ -1253,13 +1243,13 @@ module JSON
1253
1243
  # Output:
1254
1244
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1255
1245
  #
1256
- # source://json//lib/json/common.rb#930
1246
+ # source://json//lib/json/common.rb#932
1257
1247
  def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1258
1248
 
1259
- # source://json//lib/json/common.rb#206
1249
+ # source://json//lib/json/common.rb#208
1260
1250
  def dump_default_options; end
1261
1251
 
1262
- # source://json//lib/json/common.rb#206
1252
+ # source://json//lib/json/common.rb#208
1263
1253
  def dump_default_options=(val); end
1264
1254
 
1265
1255
  # :call-seq:
@@ -1276,10 +1266,10 @@ module JSON
1276
1266
  # # Raises SystemStackError (stack level too deep):
1277
1267
  # JSON.fast_generate(a)
1278
1268
  #
1279
- # source://json//lib/json/common.rb#460
1269
+ # source://json//lib/json/common.rb#462
1280
1270
  def fast_generate(obj, opts = T.unsafe(nil)); end
1281
1271
 
1282
- # source://json//lib/json/common.rb#975
1272
+ # source://json//lib/json/common.rb#977
1283
1273
  def fast_unparse(*_arg0, **_arg1, &_arg2); end
1284
1274
 
1285
1275
  # :call-seq:
@@ -1318,12 +1308,12 @@ module JSON
1318
1308
  # # Raises JSON::NestingError (nesting of 100 is too deep):
1319
1309
  # JSON.generate(a)
1320
1310
  #
1321
- # source://json//lib/json/common.rb#439
1311
+ # source://json//lib/json/common.rb#441
1322
1312
  def generate(obj, opts = T.unsafe(nil)); end
1323
1313
 
1324
1314
  # Returns the JSON generator module that is used by JSON.
1325
1315
  #
1326
- # source://json//lib/json/common.rb#177
1316
+ # source://json//lib/json/common.rb#179
1327
1317
  def generator; end
1328
1318
 
1329
1319
  # Set the module _generator_ to be used by JSON.
@@ -1468,13 +1458,13 @@ module JSON
1468
1458
  # #<Admin:0x00000000064c41f8
1469
1459
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1470
1460
  #
1471
- # source://json//lib/json/common.rb#854
1461
+ # source://json//lib/json/common.rb#856
1472
1462
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1473
1463
 
1474
- # source://json//lib/json/common.rb#206
1464
+ # source://json//lib/json/common.rb#208
1475
1465
  def load_default_options; end
1476
1466
 
1477
- # source://json//lib/json/common.rb#206
1467
+ # source://json//lib/json/common.rb#208
1478
1468
  def load_default_options=(val); end
1479
1469
 
1480
1470
  # :call-seq:
@@ -1485,7 +1475,7 @@ module JSON
1485
1475
  #
1486
1476
  # See method #parse.
1487
1477
  #
1488
- # source://json//lib/json/common.rb#388
1478
+ # source://json//lib/json/common.rb#390
1489
1479
  def load_file(filespec, opts = T.unsafe(nil)); end
1490
1480
 
1491
1481
  # :call-seq:
@@ -1496,7 +1486,7 @@ module JSON
1496
1486
  #
1497
1487
  # See method #parse!
1498
1488
  #
1499
- # source://json//lib/json/common.rb#399
1489
+ # source://json//lib/json/common.rb#401
1500
1490
  def load_file!(filespec, opts = T.unsafe(nil)); end
1501
1491
 
1502
1492
  # :call-seq:
@@ -1547,7 +1537,7 @@ module JSON
1547
1537
  # # Raises JSON::ParserError (783: unexpected token at ''):
1548
1538
  # JSON.parse('')
1549
1539
  #
1550
- # source://json//lib/json/common.rb#351
1540
+ # source://json//lib/json/common.rb#353
1551
1541
  def parse(source, opts = T.unsafe(nil)); end
1552
1542
 
1553
1543
  # :call-seq:
@@ -1562,7 +1552,7 @@ module JSON
1562
1552
  # which disables checking for nesting depth.
1563
1553
  # - Option +allow_nan+, if not provided, defaults to +true+.
1564
1554
  #
1565
- # source://json//lib/json/common.rb#373
1555
+ # source://json//lib/json/common.rb#375
1566
1556
  def parse!(source, opts = T.unsafe(nil)); end
1567
1557
 
1568
1558
  # Returns the JSON parser class that is used by JSON.
@@ -1605,30 +1595,30 @@ module JSON
1605
1595
  # }
1606
1596
  # }
1607
1597
  #
1608
- # source://json//lib/json/common.rb#507
1598
+ # source://json//lib/json/common.rb#509
1609
1599
  def pretty_generate(obj, opts = T.unsafe(nil)); end
1610
1600
 
1611
- # source://json//lib/json/common.rb#985
1601
+ # source://json//lib/json/common.rb#987
1612
1602
  def pretty_unparse(*_arg0, **_arg1, &_arg2); end
1613
1603
 
1614
- # source://json//lib/json/common.rb#995
1604
+ # source://json//lib/json/common.rb#997
1615
1605
  def restore(*_arg0, **_arg1, &_arg2); end
1616
1606
 
1617
1607
  # Sets or Returns the JSON generator state class that is used by JSON.
1618
1608
  #
1619
- # source://json//lib/json/common.rb#180
1609
+ # source://json//lib/json/common.rb#182
1620
1610
  def state; end
1621
1611
 
1622
1612
  # Sets or Returns the JSON generator state class that is used by JSON.
1623
1613
  #
1624
- # source://json//lib/json/common.rb#180
1614
+ # source://json//lib/json/common.rb#182
1625
1615
  def state=(_arg0); end
1626
1616
 
1627
1617
  # :stopdoc:
1628
1618
  # All these were meant to be deprecated circa 2009, but were just set as undocumented
1629
1619
  # so usage still exist in the wild.
1630
1620
  #
1631
- # source://json//lib/json/common.rb#965
1621
+ # source://json//lib/json/common.rb#967
1632
1622
  def unparse(*_arg0, **_arg1, &_arg2); end
1633
1623
 
1634
1624
  # :call-seq:
@@ -1762,26 +1752,26 @@ module JSON
1762
1752
  # #<Admin:0x00000000064c41f8
1763
1753
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1764
1754
  #
1765
- # source://json//lib/json/common.rb#683
1755
+ # source://json//lib/json/common.rb#685
1766
1756
  def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1767
1757
 
1768
- # source://json//lib/json/common.rb#206
1758
+ # source://json//lib/json/common.rb#208
1769
1759
  def unsafe_load_default_options; end
1770
1760
 
1771
- # source://json//lib/json/common.rb#206
1761
+ # source://json//lib/json/common.rb#208
1772
1762
  def unsafe_load_default_options=(val); end
1773
1763
 
1774
1764
  private
1775
1765
 
1776
- # source://json//lib/json/common.rb#1008
1766
+ # source://json//lib/json/common.rb#1010
1777
1767
  def const_missing(const_name); end
1778
1768
 
1779
- # source://json//lib/json/common.rb#203
1769
+ # source://json//lib/json/common.rb#205
1780
1770
  def deprecated_singleton_attr_accessor(*attrs); end
1781
1771
 
1782
1772
  # Called from the extension when a hash has both string and symbol keys
1783
1773
  #
1784
- # source://json//lib/json/common.rb#185
1774
+ # source://json//lib/json/common.rb#187
1785
1775
  def on_mixed_keys_hash(hash, do_raise); end
1786
1776
  end
1787
1777
  end
@@ -1796,13 +1786,14 @@ end
1796
1786
  #
1797
1787
  # MyApp::JSONC_CODER.load(document)
1798
1788
  #
1799
- # source://json//lib/json/common.rb#1034
1789
+ # source://json//lib/json/common.rb#1036
1800
1790
  class JSON::Coder
1801
1791
  # :call-seq:
1802
1792
  # JSON.new(options = nil, &block)
1803
1793
  #
1804
1794
  # Argument +options+, if given, contains a \Hash of options for both parsing and generating.
1805
- # See {Parsing Options}[#module-JSON-label-Parsing+Options], and {Generating Options}[#module-JSON-label-Generating+Options].
1795
+ # See {Parsing Options}[rdoc-ref:JSON@Parsing+Options],
1796
+ # and {Generating Options}[rdoc-ref:JSON@Generating+Options].
1806
1797
  #
1807
1798
  # For generation, the <tt>strict: true</tt> option is always set. When a Ruby object with no native \JSON counterpart is
1808
1799
  # encountered, the block provided to the initialize method is invoked, and must return a Ruby object that has a native
@@ -1823,7 +1814,7 @@ class JSON::Coder
1823
1814
  #
1824
1815
  # @return [Coder] a new instance of Coder
1825
1816
  #
1826
- # source://json//lib/json/common.rb#1058
1817
+ # source://json//lib/json/common.rb#1061
1827
1818
  def initialize(options = T.unsafe(nil), &as_json); end
1828
1819
 
1829
1820
  # call-seq:
@@ -1832,7 +1823,7 @@ class JSON::Coder
1832
1823
  #
1833
1824
  # Serialize the given object into a \JSON document.
1834
1825
  #
1835
- # source://json//lib/json/common.rb#1076
1826
+ # source://json//lib/json/common.rb#1079
1836
1827
  def dump(object, io = T.unsafe(nil)); end
1837
1828
 
1838
1829
  # call-seq:
@@ -1841,7 +1832,7 @@ class JSON::Coder
1841
1832
  #
1842
1833
  # Serialize the given object into a \JSON document.
1843
1834
  #
1844
- # source://json//lib/json/common.rb#1079
1835
+ # source://json//lib/json/common.rb#1082
1845
1836
  def generate(object, io = T.unsafe(nil)); end
1846
1837
 
1847
1838
  # call-seq:
@@ -1849,7 +1840,7 @@ class JSON::Coder
1849
1840
  #
1850
1841
  # Parse the given \JSON document and return an equivalent Ruby object.
1851
1842
  #
1852
- # source://json//lib/json/common.rb#1085
1843
+ # source://json//lib/json/common.rb#1088
1853
1844
  def load(source); end
1854
1845
 
1855
1846
  # call-seq:
@@ -1857,7 +1848,7 @@ class JSON::Coder
1857
1848
  #
1858
1849
  # Parse the given \JSON document and return an equivalent Ruby object.
1859
1850
  #
1860
- # source://json//lib/json/common.rb#1094
1851
+ # source://json//lib/json/common.rb#1097
1861
1852
  def load_file(path); end
1862
1853
 
1863
1854
  # call-seq:
@@ -1865,55 +1856,10 @@ class JSON::Coder
1865
1856
  #
1866
1857
  # Parse the given \JSON document and return an equivalent Ruby object.
1867
1858
  #
1868
- # source://json//lib/json/common.rb#1088
1859
+ # source://json//lib/json/common.rb#1091
1869
1860
  def parse(source); end
1870
1861
  end
1871
1862
 
1872
- module JSON::Ext::Generator::GeneratorMethods::Array
1873
- # source://json//lib/json/ext.rb#39
1874
- def to_json(*_arg0); end
1875
- end
1876
-
1877
- module JSON::Ext::Generator::GeneratorMethods::FalseClass
1878
- # source://json//lib/json/ext.rb#39
1879
- def to_json(*_arg0); end
1880
- end
1881
-
1882
- module JSON::Ext::Generator::GeneratorMethods::Float
1883
- # source://json//lib/json/ext.rb#39
1884
- def to_json(*_arg0); end
1885
- end
1886
-
1887
- module JSON::Ext::Generator::GeneratorMethods::Hash
1888
- # source://json//lib/json/ext.rb#39
1889
- def to_json(*_arg0); end
1890
- end
1891
-
1892
- module JSON::Ext::Generator::GeneratorMethods::Integer
1893
- # source://json//lib/json/ext.rb#39
1894
- def to_json(*_arg0); end
1895
- end
1896
-
1897
- module JSON::Ext::Generator::GeneratorMethods::NilClass
1898
- # source://json//lib/json/ext.rb#39
1899
- def to_json(*_arg0); end
1900
- end
1901
-
1902
- module JSON::Ext::Generator::GeneratorMethods::Object
1903
- # source://json//lib/json/ext.rb#39
1904
- def to_json(*_arg0); end
1905
- end
1906
-
1907
- module JSON::Ext::Generator::GeneratorMethods::String
1908
- # source://json//lib/json/ext.rb#39
1909
- def to_json(*_arg0); end
1910
- end
1911
-
1912
- module JSON::Ext::Generator::GeneratorMethods::TrueClass
1913
- # source://json//lib/json/ext.rb#39
1914
- def to_json(*_arg0); end
1915
- end
1916
-
1917
1863
  # source://json//lib/json/ext/generator/state.rb#6
1918
1864
  class JSON::Ext::Generator::State
1919
1865
  # call-seq: new(opts = {})
@@ -1921,7 +1867,7 @@ class JSON::Ext::Generator::State
1921
1867
  # Instantiates a new State object, configured by _opts_.
1922
1868
  #
1923
1869
  # Argument +opts+, if given, contains a \Hash of options for the generation.
1924
- # See {Generating Options}[#module-JSON-label-Generating+Options].
1870
+ # See {Generating Options}[rdoc-ref:JSON@Generating+Options].
1925
1871
  #
1926
1872
  # @return [State] a new instance of State
1927
1873
  #
@@ -1942,6 +1888,9 @@ class JSON::Ext::Generator::State
1942
1888
  # source://json//lib/json/ext/generator/state.rb#91
1943
1889
  def []=(name, value); end
1944
1890
 
1891
+ # source://json//lib/json/ext.rb#39
1892
+ def _generate_no_fallback(*_arg0); end
1893
+
1945
1894
  # source://json//lib/json/ext.rb#39
1946
1895
  def allow_nan=(_arg0); end
1947
1896
 
@@ -2085,6 +2034,9 @@ class JSON::Ext::Generator::State
2085
2034
  def initialize_copy(_arg0); end
2086
2035
 
2087
2036
  class << self
2037
+ # source://json//lib/json/ext.rb#39
2038
+ def _generate_no_fallback(_arg0, _arg1, _arg2); end
2039
+
2088
2040
  # source://json//lib/json/ext.rb#39
2089
2041
  def from_state(_arg0); end
2090
2042
 
@@ -2137,18 +2089,18 @@ end
2137
2089
  # Note: no validation is performed on the provided string. It is the
2138
2090
  # responsibility of the caller to ensure the string contains valid JSON.
2139
2091
  #
2140
- # source://json//lib/json/common.rb#287
2092
+ # source://json//lib/json/common.rb#289
2141
2093
  class JSON::Fragment < ::Struct
2142
2094
  # @return [Fragment] a new instance of Fragment
2143
2095
  #
2144
- # source://json//lib/json/common.rb#288
2096
+ # source://json//lib/json/common.rb#290
2145
2097
  def initialize(json); end
2146
2098
 
2147
2099
  # Returns the value of attribute json
2148
2100
  #
2149
2101
  # @return [Object] the current value of json
2150
2102
  #
2151
- # source://json//lib/json/common.rb#287
2103
+ # source://json//lib/json/common.rb#289
2152
2104
  def json; end
2153
2105
 
2154
2106
  # Sets the attribute json
@@ -2156,48 +2108,62 @@ class JSON::Fragment < ::Struct
2156
2108
  # @param value [Object] the value to set the attribute json to.
2157
2109
  # @return [Object] the newly set value
2158
2110
  #
2159
- # source://json//lib/json/common.rb#287
2111
+ # source://json//lib/json/common.rb#289
2160
2112
  def json=(_); end
2161
2113
 
2162
- # source://json//lib/json/common.rb#296
2114
+ # source://json//lib/json/common.rb#298
2163
2115
  def to_json(state = T.unsafe(nil), *_arg1); end
2164
2116
 
2165
2117
  class << self
2166
- # source://json//lib/json/common.rb#287
2118
+ # source://json//lib/json/common.rb#289
2167
2119
  def [](*_arg0); end
2168
2120
 
2169
- # source://json//lib/json/common.rb#287
2121
+ # source://json//lib/json/common.rb#289
2170
2122
  def inspect; end
2171
2123
 
2172
- # source://json//lib/json/common.rb#287
2124
+ # source://json//lib/json/common.rb#289
2173
2125
  def keyword_init?; end
2174
2126
 
2175
- # source://json//lib/json/common.rb#287
2127
+ # source://json//lib/json/common.rb#289
2176
2128
  def members; end
2177
2129
 
2178
- # source://json//lib/json/common.rb#287
2130
+ # source://json//lib/json/common.rb#289
2179
2131
  def new(*_arg0); end
2180
2132
  end
2181
2133
  end
2182
2134
 
2183
2135
  # This exception is raised if a generator or unparser error occurs.
2184
2136
  #
2185
- # source://json//lib/json/common.rb#257
2137
+ # source://json//lib/json/common.rb#259
2186
2138
  class JSON::GeneratorError < ::JSON::JSONError
2187
2139
  # @return [GeneratorError] a new instance of GeneratorError
2188
2140
  #
2189
- # source://json//lib/json/common.rb#260
2141
+ # source://json//lib/json/common.rb#262
2190
2142
  def initialize(message, invalid_object = T.unsafe(nil)); end
2191
2143
 
2192
- # source://json//lib/json/common.rb#265
2144
+ # source://json//lib/json/common.rb#267
2193
2145
  def detailed_message(*_arg0, **_arg1, &_arg2); end
2194
2146
 
2195
2147
  # Returns the value of attribute invalid_object.
2196
2148
  #
2197
- # source://json//lib/json/common.rb#258
2149
+ # source://json//lib/json/common.rb#260
2198
2150
  def invalid_object; end
2199
2151
  end
2200
2152
 
2153
+ # source://json//lib/json/common.rb#1102
2154
+ module JSON::GeneratorMethods
2155
+ # call-seq: to_json(*)
2156
+ #
2157
+ # Converts this object into a JSON string.
2158
+ # If this object doesn't directly maps to a JSON native type,
2159
+ # first convert it to a string (calling #to_s), then converts
2160
+ # it to a JSON string, and returns the result.
2161
+ # This is a fallback, if no special method #to_json was defined for some object.
2162
+ #
2163
+ # source://json//lib/json/common.rb#1110
2164
+ def to_json(state = T.unsafe(nil), *_arg1); end
2165
+ end
2166
+
2201
2167
  # source://json//lib/json/generic_object.rb#9
2202
2168
  class JSON::GenericObject < ::OpenStruct
2203
2169
  # source://json//lib/json/generic_object.rb#59
@@ -2242,10 +2208,10 @@ class JSON::GenericObject < ::OpenStruct
2242
2208
  end
2243
2209
  end
2244
2210
 
2245
- # source://json//lib/json/common.rb#356
2211
+ # source://json//lib/json/common.rb#358
2246
2212
  JSON::PARSE_L_OPTIONS = T.let(T.unsafe(nil), Hash)
2247
2213
 
2248
- # source://json//lib/json/common.rb#469
2214
+ # source://json//lib/json/common.rb#471
2249
2215
  JSON::PRETTY_GENERATE_OPTIONS = T.let(T.unsafe(nil), Hash)
2250
2216
 
2251
2217
  # source://json//lib/json/common.rb#152
@@ -2253,16 +2219,16 @@ JSON::Parser = JSON::Ext::Parser
2253
2219
 
2254
2220
  # This exception is raised if a parser error occurs.
2255
2221
  #
2256
- # source://json//lib/json/common.rb#248
2222
+ # source://json//lib/json/common.rb#250
2257
2223
  class JSON::ParserError < ::JSON::JSONError
2258
2224
  # Returns the value of attribute column.
2259
2225
  #
2260
- # source://json//lib/json/common.rb#249
2226
+ # source://json//lib/json/common.rb#251
2261
2227
  def column; end
2262
2228
 
2263
2229
  # Returns the value of attribute line.
2264
2230
  #
2265
- # source://json//lib/json/common.rb#249
2231
+ # source://json//lib/json/common.rb#251
2266
2232
  def line; end
2267
2233
  end
2268
2234
 
@@ -2290,10 +2256,10 @@ module JSON::ParserOptions
2290
2256
  end
2291
2257
  end
2292
2258
 
2293
- # source://json//lib/json/common.rb#171
2259
+ # source://json//lib/json/common.rb#173
2294
2260
  JSON::State = JSON::Ext::Generator::State
2295
2261
 
2296
- # source://json//lib/json/common.rb#1100
2262
+ # source://json//lib/json/common.rb#1127
2297
2263
  module Kernel
2298
2264
  private
2299
2265
 
@@ -2304,37 +2270,25 @@ module Kernel
2304
2270
  # The _opts_ argument is passed through to generate/parse respectively. See
2305
2271
  # generate and parse for their documentation.
2306
2272
  #
2307
- # source://json//lib/json/common.rb#1139
2273
+ # source://json//lib/json/common.rb#1166
2308
2274
  def JSON(object, opts = T.unsafe(nil)); end
2309
2275
 
2310
2276
  # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
2311
2277
  # one line.
2312
2278
  #
2313
- # source://json//lib/json/common.rb#1105
2279
+ # source://json//lib/json/common.rb#1132
2314
2280
  def j(*objs); end
2315
2281
 
2316
2282
  # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
2317
2283
  # indentation and over many lines.
2318
2284
  #
2319
- # source://json//lib/json/common.rb#1120
2285
+ # source://json//lib/json/common.rb#1147
2320
2286
  def jj(*objs); end
2321
2287
  end
2322
2288
 
2323
- class NilClass
2324
- include ::JSON::Ext::Generator::GeneratorMethods::NilClass
2325
- end
2326
-
2289
+ # source://json//lib/json/common.rb#1171
2327
2290
  class Object < ::BasicObject
2328
2291
  include ::Kernel
2329
2292
  include ::PP::ObjectMixin
2330
- include ::JSON::Ext::Generator::GeneratorMethods::Object
2331
- end
2332
-
2333
- class String
2334
- include ::Comparable
2335
- include ::JSON::Ext::Generator::GeneratorMethods::String
2336
- end
2337
-
2338
- class TrueClass
2339
- include ::JSON::Ext::Generator::GeneratorMethods::TrueClass
2293
+ include ::JSON::GeneratorMethods
2340
2294
  end