lunchmoney 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +7 -0
  3. data/.github/workflows/build_and_publish_yard_docs.yml +2 -2
  4. data/.github/workflows/ci.yml +1 -1
  5. data/.ruby-version +1 -1
  6. data/.simplecov +1 -0
  7. data/Gemfile +2 -2
  8. data/Gemfile.lock +65 -57
  9. data/lib/lunchmoney/api.rb +1 -0
  10. data/lib/lunchmoney/calls/categories.rb +0 -2
  11. data/lib/lunchmoney/calls/transactions.rb +0 -1
  12. data/lib/lunchmoney/deprecate.rb +35 -0
  13. data/lib/lunchmoney/objects/asset.rb +6 -1
  14. data/lib/lunchmoney/objects/plaid_account.rb +6 -1
  15. data/lib/lunchmoney/version.rb +1 -1
  16. data/sorbet/rbi/annotations/activesupport.rbi +5 -0
  17. data/sorbet/rbi/gems/{activesupport@7.2.1.rbi → activesupport@7.2.2.1.rbi} +109 -86
  18. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  19. data/sorbet/rbi/gems/{concurrent-ruby@1.3.4.rbi → concurrent-ruby@1.3.5.rbi} +44 -32
  20. data/sorbet/rbi/gems/{connection_pool@2.4.1.rbi → connection_pool@2.5.0.rbi} +1 -0
  21. data/sorbet/rbi/gems/{dotenv@3.1.2.rbi → dotenv@3.1.7.rbi} +21 -29
  22. data/sorbet/rbi/gems/{erubi@1.13.0.rbi → erubi@1.13.1.rbi} +14 -9
  23. data/sorbet/rbi/gems/{faraday-net_http@3.1.1.rbi → faraday-net_http@3.4.0.rbi} +34 -34
  24. data/sorbet/rbi/gems/{faraday@2.10.1.rbi → faraday@2.12.2.rbi} +43 -34
  25. data/sorbet/rbi/gems/{i18n@1.14.5.rbi → i18n@1.14.7.rbi} +80 -80
  26. data/sorbet/rbi/gems/{json@2.7.2.rbi → json@2.10.2.rbi} +697 -146
  27. data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
  28. data/sorbet/rbi/gems/{logger@1.6.0.rbi → logger@1.6.6.rbi} +109 -72
  29. data/sorbet/rbi/gems/{minitest@5.25.1.rbi → minitest@5.25.5.rbi} +227 -220
  30. data/sorbet/rbi/gems/{mocha@2.4.5.rbi → mocha@2.7.1.rbi} +154 -118
  31. data/sorbet/rbi/gems/{net-http@0.4.1.rbi → net-http@0.6.0.rbi} +360 -181
  32. data/sorbet/rbi/gems/{parser@3.3.4.2.rbi → parser@3.3.7.1.rbi} +23 -17
  33. data/sorbet/rbi/gems/{prism@0.30.0.rbi → prism@1.4.0.rbi} +12440 -9920
  34. data/sorbet/rbi/gems/{rack@3.1.7.rbi → rack@3.1.9.rbi} +91 -83
  35. data/sorbet/rbi/gems/rbi@0.3.1.rbi +6599 -0
  36. data/sorbet/rbi/gems/rbs@3.9.0.rbi +6978 -0
  37. data/sorbet/rbi/gems/{regexp_parser@2.9.2.rbi → regexp_parser@2.10.0.rbi} +193 -170
  38. data/sorbet/rbi/gems/{rexml@3.3.6.rbi → rexml@3.4.1.rbi} +541 -114
  39. data/sorbet/rbi/gems/{rubocop-ast@1.32.1.rbi → rubocop-ast@1.38.0.rbi} +1224 -622
  40. data/sorbet/rbi/gems/{rubocop-minitest@0.35.1.rbi → rubocop-minitest@0.36.0.rbi} +5 -5
  41. data/sorbet/rbi/gems/{rubocop-rails@2.26.0.rbi → rubocop-rails@2.29.1.rbi} +9412 -6480
  42. data/sorbet/rbi/gems/{rubocop-sorbet@0.8.5.rbi → rubocop-sorbet@0.8.7.rbi} +44 -1
  43. data/sorbet/rbi/gems/{rubocop@1.65.1.rbi → rubocop@1.71.2.rbi} +5606 -3467
  44. data/sorbet/rbi/gems/{securerandom@0.3.1.rbi → securerandom@0.4.1.rbi} +7 -5
  45. data/sorbet/rbi/gems/{spoom@1.4.2.rbi → spoom@1.6.1.rbi} +3315 -973
  46. data/sorbet/rbi/gems/{tapioca@0.16.1.rbi → tapioca@0.16.11.rbi} +300 -234
  47. data/sorbet/rbi/gems/{thor@1.3.1.rbi → thor@1.3.2.rbi} +58 -31
  48. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  49. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  50. data/sorbet/rbi/gems/{uri@0.13.0.rbi → uri@1.0.3.rbi} +278 -256
  51. data/sorbet/rbi/gems/{webmock@3.23.1.rbi → webmock@3.25.1.rbi} +101 -78
  52. data/sorbet/rbi/gems/{yard@0.9.36.rbi → yard@0.9.37.rbi} +394 -235
  53. metadata +42 -44
  54. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14237
  55. data/sorbet/rbi/gems/rbi@0.1.14.rbi +0 -3305
  56. data/sorbet/rbi/gems/strscan@3.1.0.rbi +0 -9
  57. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +0 -65
  58. /data/sorbet/rbi/gems/{bigdecimal@3.1.8.rbi → bigdecimal@3.1.9.rbi} +0 -0
  59. /data/sorbet/rbi/gems/{hashdiff@1.1.1.rbi → hashdiff@1.1.2.rbi} +0 -0
@@ -4,9 +4,15 @@
4
4
  # This is an autogenerated file for types exported from the `json` gem.
5
5
  # Please instead update this file by running `bin/tapioca gem json`.
6
6
 
7
+
8
+ class Array
9
+ include ::Enumerable
10
+ include ::JSON::Ext::Generator::GeneratorMethods::Array
11
+ end
12
+
7
13
  # Extends any Class to include _json_creatable?_ method.
8
14
  #
9
- # source://json//lib/json/common.rb#690
15
+ # source://json//lib/json/common.rb#979
10
16
  class Class < ::Module
11
17
  # Returns true if this class can be used to create an instance
12
18
  # from a serialised JSON string. The class has to implement a class
@@ -15,10 +21,27 @@ class Class < ::Module
15
21
  #
16
22
  # @return [Boolean]
17
23
  #
18
- # source://json//lib/json/common.rb#695
24
+ # source://json//lib/json/common.rb#984
19
25
  def json_creatable?; end
20
26
  end
21
27
 
28
+ class FalseClass
29
+ include ::JSON::Ext::Generator::GeneratorMethods::FalseClass
30
+ end
31
+
32
+ class Float < ::Numeric
33
+ include ::JSON::Ext::Generator::GeneratorMethods::Float
34
+ end
35
+
36
+ class Hash
37
+ include ::Enumerable
38
+ include ::JSON::Ext::Generator::GeneratorMethods::Hash
39
+ end
40
+
41
+ class Integer < ::Numeric
42
+ include ::JSON::Ext::Generator::GeneratorMethods::Integer
43
+ end
44
+
22
45
  # = JavaScript \Object Notation (\JSON)
23
46
  #
24
47
  # \JSON is a lightweight data-interchange format.
@@ -395,13 +418,13 @@ end
395
418
  # json1 = JSON.generate(ruby)
396
419
  # ruby1 = JSON.parse(json1, create_additions: true)
397
420
  # # Make a nice display.
398
- # display = <<EOT
399
- # Generated JSON:
400
- # Without addition: #{json0} (#{json0.class})
401
- # With addition: #{json1} (#{json1.class})
402
- # Parsed JSON:
403
- # Without addition: #{ruby0.inspect} (#{ruby0.class})
404
- # With addition: #{ruby1.inspect} (#{ruby1.class})
421
+ # display = <<~EOT
422
+ # Generated JSON:
423
+ # Without addition: #{json0} (#{json0.class})
424
+ # With addition: #{json1} (#{json1.class})
425
+ # Parsed JSON:
426
+ # Without addition: #{ruby0.inspect} (#{ruby0.class})
427
+ # With addition: #{ruby1.inspect} (#{ruby1.class})
405
428
  # EOT
406
429
  # puts display
407
430
  #
@@ -579,13 +602,13 @@ end
579
602
  # json1 = JSON.generate(foo1)
580
603
  # obj1 = JSON.parse(json1, create_additions: true)
581
604
  # # Make a nice display.
582
- # display = <<EOT
583
- # Generated JSON:
584
- # Without custom addition: #{json0} (#{json0.class})
585
- # With custom addition: #{json1} (#{json1.class})
586
- # Parsed JSON:
587
- # Without custom addition: #{obj0.inspect} (#{obj0.class})
588
- # With custom addition: #{obj1.inspect} (#{obj1.class})
605
+ # display = <<~EOT
606
+ # Generated JSON:
607
+ # Without custom addition: #{json0} (#{json0.class})
608
+ # With custom addition: #{json1} (#{json1.class})
609
+ # Parsed JSON:
610
+ # Without custom addition: #{obj0.inspect} (#{obj0.class})
611
+ # With custom addition: #{obj1.inspect} (#{obj1.class})
589
612
  # EOT
590
613
  # puts display
591
614
  #
@@ -598,7 +621,7 @@ end
598
621
  # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
599
622
  # With custom addition: #<Foo:0x0000000006473bb8 @bar=0, @baz=1> (Foo)
600
623
  #
601
- # source://json//lib/json/version.rb#2
624
+ # source://json//lib/json/version.rb#3
602
625
  module JSON
603
626
  private
604
627
 
@@ -630,7 +653,7 @@ module JSON
630
653
  # Output:
631
654
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
632
655
  #
633
- # source://json//lib/json/common.rb#615
656
+ # source://json//lib/json/common.rb#823
634
657
  def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
635
658
 
636
659
  # :call-seq:
@@ -647,13 +670,13 @@ module JSON
647
670
  # # Raises SystemStackError (stack level too deep):
648
671
  # JSON.fast_generate(a)
649
672
  #
650
- # source://json//lib/json/common.rb#329
673
+ # source://json//lib/json/common.rb#357
651
674
  def fast_generate(obj, opts = T.unsafe(nil)); end
652
675
 
653
676
  # :stopdoc:
654
677
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
655
678
  #
656
- # source://json//lib/json/common.rb#329
679
+ # source://json//lib/json/common.rb#357
657
680
  def fast_unparse(obj, opts = T.unsafe(nil)); end
658
681
 
659
682
  # :call-seq:
@@ -692,7 +715,7 @@ module JSON
692
715
  # # Raises JSON::NestingError (nesting of 100 is too deep):
693
716
  # JSON.generate(a)
694
717
  #
695
- # source://json//lib/json/common.rb#300
718
+ # source://json//lib/json/common.rb#329
696
719
  def generate(obj, opts = T.unsafe(nil)); end
697
720
 
698
721
  # :call-seq:
@@ -700,6 +723,16 @@ module JSON
700
723
  #
701
724
  # Returns the Ruby objects created by parsing the given +source+.
702
725
  #
726
+ # BEWARE: This method is meant to serialise data from trusted user input,
727
+ # like from your own database server or clients under your control, it could
728
+ # be dangerous to allow untrusted users to pass JSON sources into it.
729
+ # If you must use it, use JSON.unsafe_load instead to make it clear.
730
+ #
731
+ # Since JSON version 2.8.0, `load` emits a deprecation warning when a
732
+ # non native type is deserialized, without `create_additions` being explicitly
733
+ # enabled, and in JSON version 3.0, `load` will have `create_additions` disabled
734
+ # by default.
735
+ #
703
736
  # - Argument +source+ must be, or be convertible to, a \String:
704
737
  # - If +source+ responds to instance method +to_str+,
705
738
  # <tt>source.to_str</tt> becomes the source.
@@ -714,9 +747,6 @@ module JSON
714
747
  # - Argument +proc+, if given, must be a \Proc that accepts one argument.
715
748
  # It will be called recursively with each result (depth-first order).
716
749
  # See details below.
717
- # BEWARE: This method is meant to serialise data from trusted user input,
718
- # like from your own database server or clients under your control, it could
719
- # be dangerous to allow untrusted users to pass JSON sources into it.
720
750
  # - Argument +opts+, if given, contains a \Hash of options for the parsing.
721
751
  # See {Parsing Options}[#module-JSON-label-Parsing+Options].
722
752
  # The default options can be changed via method JSON.load_default_options=.
@@ -727,17 +757,17 @@ module JSON
727
757
  # <tt>parse(source, opts)</tt>; see #parse.
728
758
  #
729
759
  # Source for following examples:
730
- # source = <<-EOT
731
- # {
732
- # "name": "Dave",
733
- # "age" :40,
734
- # "hats": [
735
- # "Cattleman's",
736
- # "Panama",
737
- # "Tophat"
738
- # ]
739
- # }
740
- # EOT
760
+ # source = <<~JSON
761
+ # {
762
+ # "name": "Dave",
763
+ # "age" :40,
764
+ # "hats": [
765
+ # "Cattleman's",
766
+ # "Panama",
767
+ # "Tophat"
768
+ # ]
769
+ # }
770
+ # JSON
741
771
  #
742
772
  # Load a \String:
743
773
  # ruby = JSON.load(source)
@@ -823,7 +853,7 @@ module JSON
823
853
  # #<Admin:0x00000000064c41f8
824
854
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
825
855
  #
826
- # source://json//lib/json/common.rb#541
856
+ # source://json//lib/json/common.rb#742
827
857
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
828
858
 
829
859
  # :call-seq:
@@ -834,7 +864,7 @@ module JSON
834
864
  #
835
865
  # See method #parse.
836
866
  #
837
- # source://json//lib/json/common.rb#249
867
+ # source://json//lib/json/common.rb#278
838
868
  def load_file(filespec, opts = T.unsafe(nil)); end
839
869
 
840
870
  # :call-seq:
@@ -845,12 +875,9 @@ module JSON
845
875
  #
846
876
  # See method #parse!
847
877
  #
848
- # source://json//lib/json/common.rb#260
878
+ # source://json//lib/json/common.rb#289
849
879
  def load_file!(filespec, opts = T.unsafe(nil)); end
850
880
 
851
- # source://json//lib/json/common.rb#643
852
- def merge_dump_options(opts, strict: T.unsafe(nil)); end
853
-
854
881
  # :call-seq:
855
882
  # JSON.parse(source, opts) -> object
856
883
  #
@@ -879,17 +906,17 @@ module JSON
879
906
  # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
880
907
  #
881
908
  # Parses nested JSON objects:
882
- # source = <<-EOT
883
- # {
884
- # "name": "Dave",
885
- # "age" :40,
886
- # "hats": [
887
- # "Cattleman's",
888
- # "Panama",
889
- # "Tophat"
890
- # ]
891
- # }
892
- # EOT
909
+ # source = <<~JSON
910
+ # {
911
+ # "name": "Dave",
912
+ # "age" :40,
913
+ # "hats": [
914
+ # "Cattleman's",
915
+ # "Panama",
916
+ # "Tophat"
917
+ # ]
918
+ # }
919
+ # JSON
893
920
  # ruby = JSON.parse(source)
894
921
  # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
895
922
  #
@@ -899,7 +926,7 @@ module JSON
899
926
  # # Raises JSON::ParserError (783: unexpected token at ''):
900
927
  # JSON.parse('')
901
928
  #
902
- # source://json//lib/json/common.rb#219
929
+ # source://json//lib/json/common.rb#247
903
930
  def parse(source, opts = T.unsafe(nil)); end
904
931
 
905
932
  # :call-seq:
@@ -914,7 +941,7 @@ module JSON
914
941
  # which disables checking for nesting depth.
915
942
  # - Option +allow_nan+, if not provided, defaults to +true+.
916
943
  #
917
- # source://json//lib/json/common.rb#234
944
+ # source://json//lib/json/common.rb#262
918
945
  def parse!(source, opts = T.unsafe(nil)); end
919
946
 
920
947
  # :call-seq:
@@ -947,30 +974,162 @@ module JSON
947
974
  # }
948
975
  # }
949
976
  #
950
- # source://json//lib/json/common.rb#374
977
+ # source://json//lib/json/common.rb#402
951
978
  def pretty_generate(obj, opts = T.unsafe(nil)); end
952
979
 
953
980
  # :stopdoc:
954
981
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
955
982
  #
956
- # source://json//lib/json/common.rb#374
983
+ # source://json//lib/json/common.rb#402
957
984
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
958
985
 
959
986
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
960
987
  #
961
- # source://json//lib/json/common.rb#559
988
+ # source://json//lib/json/common.rb#768
962
989
  def recurse_proc(result, &proc); end
963
990
 
964
- # source://json//lib/json/common.rb#541
991
+ # source://json//lib/json/common.rb#742
965
992
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
966
993
 
967
994
  # :stopdoc:
968
995
  # I want to deprecate these later, so I'll first be silent about them, and
969
996
  # later delete them.
970
997
  #
971
- # source://json//lib/json/common.rb#300
998
+ # source://json//lib/json/common.rb#329
972
999
  def unparse(obj, opts = T.unsafe(nil)); end
973
1000
 
1001
+ # :call-seq:
1002
+ # JSON.unsafe_load(source, proc = nil, options = {}) -> object
1003
+ #
1004
+ # Returns the Ruby objects created by parsing the given +source+.
1005
+ #
1006
+ # BEWARE: This method is meant to serialise data from trusted user input,
1007
+ # like from your own database server or clients under your control, it could
1008
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1009
+ #
1010
+ # - Argument +source+ must be, or be convertible to, a \String:
1011
+ # - If +source+ responds to instance method +to_str+,
1012
+ # <tt>source.to_str</tt> becomes the source.
1013
+ # - If +source+ responds to instance method +to_io+,
1014
+ # <tt>source.to_io.read</tt> becomes the source.
1015
+ # - If +source+ responds to instance method +read+,
1016
+ # <tt>source.read</tt> becomes the source.
1017
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1018
+ # - Option +allow_blank+ specifies a truthy value.
1019
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1020
+ # - Otherwise, +source+ remains the source.
1021
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1022
+ # It will be called recursively with each result (depth-first order).
1023
+ # See details below.
1024
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1025
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1026
+ # The default options can be changed via method JSON.unsafe_load_default_options=.
1027
+ #
1028
+ # ---
1029
+ #
1030
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1031
+ # <tt>parse(source, opts)</tt>; see #parse.
1032
+ #
1033
+ # Source for following examples:
1034
+ # source = <<~JSON
1035
+ # {
1036
+ # "name": "Dave",
1037
+ # "age" :40,
1038
+ # "hats": [
1039
+ # "Cattleman's",
1040
+ # "Panama",
1041
+ # "Tophat"
1042
+ # ]
1043
+ # }
1044
+ # JSON
1045
+ #
1046
+ # Load a \String:
1047
+ # ruby = JSON.unsafe_load(source)
1048
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1049
+ #
1050
+ # Load an \IO object:
1051
+ # require 'stringio'
1052
+ # object = JSON.unsafe_load(StringIO.new(source))
1053
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1054
+ #
1055
+ # Load a \File object:
1056
+ # path = 't.json'
1057
+ # File.write(path, source)
1058
+ # File.open(path) do |file|
1059
+ # JSON.unsafe_load(file)
1060
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1061
+ #
1062
+ # ---
1063
+ #
1064
+ # When +proc+ is given:
1065
+ # - Modifies +source+ as above.
1066
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1067
+ # - Recursively calls <tt>proc(result)</tt>.
1068
+ # - Returns the final result.
1069
+ #
1070
+ # Example:
1071
+ # require 'json'
1072
+ #
1073
+ # # Some classes for the example.
1074
+ # class Base
1075
+ # def initialize(attributes)
1076
+ # @attributes = attributes
1077
+ # end
1078
+ # end
1079
+ # class User < Base; end
1080
+ # class Account < Base; end
1081
+ # class Admin < Base; end
1082
+ # # The JSON source.
1083
+ # json = <<-EOF
1084
+ # {
1085
+ # "users": [
1086
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1087
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1088
+ # ],
1089
+ # "accounts": [
1090
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1091
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1092
+ # ],
1093
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1094
+ # }
1095
+ # EOF
1096
+ # # Deserializer method.
1097
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1098
+ # type = obj.is_a?(Hash) && obj["type"]
1099
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1100
+ # end
1101
+ # # Call to JSON.unsafe_load
1102
+ # ruby = JSON.unsafe_load(json, proc {|obj|
1103
+ # case obj
1104
+ # when Hash
1105
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1106
+ # when Array
1107
+ # obj.map! {|v| deserialize_obj v }
1108
+ # end
1109
+ # })
1110
+ # pp ruby
1111
+ # Output:
1112
+ # {"users"=>
1113
+ # [#<User:0x00000000064c4c98
1114
+ # @attributes=
1115
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1116
+ # #<User:0x00000000064c4bd0
1117
+ # @attributes=
1118
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1119
+ # "accounts"=>
1120
+ # [{"account"=>
1121
+ # #<Account:0x00000000064c4928
1122
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1123
+ # {"account"=>
1124
+ # #<Account:0x00000000064c4680
1125
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1126
+ # "admins"=>
1127
+ # #<Admin:0x00000000064c41f8
1128
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1129
+ #
1130
+ # source://json//lib/json/common.rb#582
1131
+ def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1132
+
974
1133
  class << self
975
1134
  # :call-seq:
976
1135
  # JSON[object] -> new_array or new_string
@@ -984,26 +1143,26 @@ module JSON
984
1143
  # ruby = [0, 1, nil]
985
1144
  # JSON[ruby] # => '[0,1,null]'
986
1145
  #
987
- # source://json//lib/json/common.rb#22
1146
+ # source://json//lib/json/common.rb#23
988
1147
  def [](object, opts = T.unsafe(nil)); end
989
1148
 
990
- # source://json//lib/json/common.rb#85
1149
+ # source://json//lib/json/common.rb#80
991
1150
  def create_fast_state; end
992
1151
 
993
1152
  # Returns the current create identifier.
994
1153
  # See also JSON.create_id=.
995
1154
  #
996
- # source://json//lib/json/common.rb#130
1155
+ # source://json//lib/json/common.rb#115
997
1156
  def create_id; end
998
1157
 
999
1158
  # Sets create identifier, which is used to decide if the _json_create_
1000
1159
  # hook of a class should be called; initial value is +json_class+:
1001
1160
  # JSON.create_id # => 'json_class'
1002
1161
  #
1003
- # source://json//lib/json/common.rb#124
1162
+ # source://json//lib/json/common.rb#109
1004
1163
  def create_id=(new_value); end
1005
1164
 
1006
- # source://json//lib/json/common.rb#95
1165
+ # source://json//lib/json/common.rb#90
1007
1166
  def create_pretty_state; end
1008
1167
 
1009
1168
  # Return the constant located at _path_. The format of _path_ has to be
@@ -1011,7 +1170,7 @@ module JSON
1011
1170
  # level (absolute namespace path?). If there doesn't exist a constant at
1012
1171
  # the given path, an ArgumentError is raised.
1013
1172
  #
1014
- # source://json//lib/json/common.rb#46
1173
+ # source://json//lib/json/common.rb#50
1015
1174
  def deep_const_get(path); end
1016
1175
 
1017
1176
  # :call-seq:
@@ -1042,23 +1201,23 @@ module JSON
1042
1201
  # Output:
1043
1202
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1044
1203
  #
1045
- # source://json//lib/json/common.rb#615
1204
+ # source://json//lib/json/common.rb#823
1046
1205
  def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1047
1206
 
1048
1207
  # Sets or returns the default options for the JSON.dump method.
1049
1208
  # Initially:
1050
1209
  # opts = JSON.dump_default_options
1051
- # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1210
+ # opts # => {:max_nesting=>false, :allow_nan=>true}
1052
1211
  #
1053
- # source://json//lib/json/common.rb#580
1212
+ # source://json//lib/json/common.rb#789
1054
1213
  def dump_default_options; end
1055
1214
 
1056
1215
  # Sets or returns the default options for the JSON.dump method.
1057
1216
  # Initially:
1058
1217
  # opts = JSON.dump_default_options
1059
- # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1218
+ # opts # => {:max_nesting=>false, :allow_nan=>true}
1060
1219
  #
1061
- # source://json//lib/json/common.rb#580
1220
+ # source://json//lib/json/common.rb#789
1062
1221
  def dump_default_options=(_arg0); end
1063
1222
 
1064
1223
  # :call-seq:
@@ -1075,13 +1234,13 @@ module JSON
1075
1234
  # # Raises SystemStackError (stack level too deep):
1076
1235
  # JSON.fast_generate(a)
1077
1236
  #
1078
- # source://json//lib/json/common.rb#329
1237
+ # source://json//lib/json/common.rb#357
1079
1238
  def fast_generate(obj, opts = T.unsafe(nil)); end
1080
1239
 
1081
1240
  # :stopdoc:
1082
1241
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1083
1242
  #
1084
- # source://json//lib/json/common.rb#329
1243
+ # source://json//lib/json/common.rb#357
1085
1244
  def fast_unparse(obj, opts = T.unsafe(nil)); end
1086
1245
 
1087
1246
  # :call-seq:
@@ -1120,24 +1279,22 @@ module JSON
1120
1279
  # # Raises JSON::NestingError (nesting of 100 is too deep):
1121
1280
  # JSON.generate(a)
1122
1281
  #
1123
- # source://json//lib/json/common.rb#300
1282
+ # source://json//lib/json/common.rb#329
1124
1283
  def generate(obj, opts = T.unsafe(nil)); end
1125
1284
 
1126
- # Returns the JSON generator module that is used by JSON. This is
1127
- # either JSON::Ext::Generator or JSON::Pure::Generator:
1128
- # JSON.generator # => JSON::Ext::Generator
1285
+ # Returns the JSON generator module that is used by JSON.
1129
1286
  #
1130
- # source://json//lib/json/common.rb#107
1287
+ # source://json//lib/json/common.rb#100
1131
1288
  def generator; end
1132
1289
 
1133
1290
  # Set the module _generator_ to be used by JSON.
1134
1291
  #
1135
- # source://json//lib/json/common.rb#62
1292
+ # source://json//lib/json/common.rb#57
1136
1293
  def generator=(generator); end
1137
1294
 
1138
1295
  # Encodes string using String.encode.
1139
1296
  #
1140
- # source://json//lib/json/common.rb#639
1297
+ # source://json//lib/json/common.rb#856
1141
1298
  def iconv(to, from, string); end
1142
1299
 
1143
1300
  # :call-seq:
@@ -1145,6 +1302,16 @@ module JSON
1145
1302
  #
1146
1303
  # Returns the Ruby objects created by parsing the given +source+.
1147
1304
  #
1305
+ # BEWARE: This method is meant to serialise data from trusted user input,
1306
+ # like from your own database server or clients under your control, it could
1307
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1308
+ # If you must use it, use JSON.unsafe_load instead to make it clear.
1309
+ #
1310
+ # Since JSON version 2.8.0, `load` emits a deprecation warning when a
1311
+ # non native type is deserialized, without `create_additions` being explicitly
1312
+ # enabled, and in JSON version 3.0, `load` will have `create_additions` disabled
1313
+ # by default.
1314
+ #
1148
1315
  # - Argument +source+ must be, or be convertible to, a \String:
1149
1316
  # - If +source+ responds to instance method +to_str+,
1150
1317
  # <tt>source.to_str</tt> becomes the source.
@@ -1159,9 +1326,6 @@ module JSON
1159
1326
  # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1160
1327
  # It will be called recursively with each result (depth-first order).
1161
1328
  # See details below.
1162
- # BEWARE: This method is meant to serialise data from trusted user input,
1163
- # like from your own database server or clients under your control, it could
1164
- # be dangerous to allow untrusted users to pass JSON sources into it.
1165
1329
  # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1166
1330
  # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1167
1331
  # The default options can be changed via method JSON.load_default_options=.
@@ -1172,17 +1336,17 @@ module JSON
1172
1336
  # <tt>parse(source, opts)</tt>; see #parse.
1173
1337
  #
1174
1338
  # Source for following examples:
1175
- # source = <<-EOT
1176
- # {
1177
- # "name": "Dave",
1178
- # "age" :40,
1179
- # "hats": [
1180
- # "Cattleman's",
1181
- # "Panama",
1182
- # "Tophat"
1183
- # ]
1184
- # }
1185
- # EOT
1339
+ # source = <<~JSON
1340
+ # {
1341
+ # "name": "Dave",
1342
+ # "age" :40,
1343
+ # "hats": [
1344
+ # "Cattleman's",
1345
+ # "Panama",
1346
+ # "Tophat"
1347
+ # ]
1348
+ # }
1349
+ # JSON
1186
1350
  #
1187
1351
  # Load a \String:
1188
1352
  # ruby = JSON.load(source)
@@ -1268,7 +1432,7 @@ module JSON
1268
1432
  # #<Admin:0x00000000064c41f8
1269
1433
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1270
1434
  #
1271
- # source://json//lib/json/common.rb#541
1435
+ # source://json//lib/json/common.rb#742
1272
1436
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1273
1437
 
1274
1438
  # Sets or returns default options for the JSON.load method.
@@ -1276,7 +1440,7 @@ module JSON
1276
1440
  # opts = JSON.load_default_options
1277
1441
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1278
1442
  #
1279
- # source://json//lib/json/common.rb#404
1443
+ # source://json//lib/json/common.rb#446
1280
1444
  def load_default_options; end
1281
1445
 
1282
1446
  # Sets or returns default options for the JSON.load method.
@@ -1284,7 +1448,7 @@ module JSON
1284
1448
  # opts = JSON.load_default_options
1285
1449
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1286
1450
  #
1287
- # source://json//lib/json/common.rb#404
1451
+ # source://json//lib/json/common.rb#446
1288
1452
  def load_default_options=(_arg0); end
1289
1453
 
1290
1454
  # :call-seq:
@@ -1295,7 +1459,7 @@ module JSON
1295
1459
  #
1296
1460
  # See method #parse.
1297
1461
  #
1298
- # source://json//lib/json/common.rb#249
1462
+ # source://json//lib/json/common.rb#278
1299
1463
  def load_file(filespec, opts = T.unsafe(nil)); end
1300
1464
 
1301
1465
  # :call-seq:
@@ -1306,7 +1470,7 @@ module JSON
1306
1470
  #
1307
1471
  # See method #parse!
1308
1472
  #
1309
- # source://json//lib/json/common.rb#260
1473
+ # source://json//lib/json/common.rb#289
1310
1474
  def load_file!(filespec, opts = T.unsafe(nil)); end
1311
1475
 
1312
1476
  # :call-seq:
@@ -1337,17 +1501,17 @@ module JSON
1337
1501
  # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
1338
1502
  #
1339
1503
  # Parses nested JSON objects:
1340
- # source = <<-EOT
1341
- # {
1342
- # "name": "Dave",
1343
- # "age" :40,
1344
- # "hats": [
1345
- # "Cattleman's",
1346
- # "Panama",
1347
- # "Tophat"
1348
- # ]
1349
- # }
1350
- # EOT
1504
+ # source = <<~JSON
1505
+ # {
1506
+ # "name": "Dave",
1507
+ # "age" :40,
1508
+ # "hats": [
1509
+ # "Cattleman's",
1510
+ # "Panama",
1511
+ # "Tophat"
1512
+ # ]
1513
+ # }
1514
+ # JSON
1351
1515
  # ruby = JSON.parse(source)
1352
1516
  # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1353
1517
  #
@@ -1357,7 +1521,7 @@ module JSON
1357
1521
  # # Raises JSON::ParserError (783: unexpected token at ''):
1358
1522
  # JSON.parse('')
1359
1523
  #
1360
- # source://json//lib/json/common.rb#219
1524
+ # source://json//lib/json/common.rb#247
1361
1525
  def parse(source, opts = T.unsafe(nil)); end
1362
1526
 
1363
1527
  # :call-seq:
@@ -1372,19 +1536,17 @@ module JSON
1372
1536
  # which disables checking for nesting depth.
1373
1537
  # - Option +allow_nan+, if not provided, defaults to +true+.
1374
1538
  #
1375
- # source://json//lib/json/common.rb#234
1539
+ # source://json//lib/json/common.rb#262
1376
1540
  def parse!(source, opts = T.unsafe(nil)); end
1377
1541
 
1378
- # Returns the JSON parser class that is used by JSON. This is either
1379
- # JSON::Ext::Parser or JSON::Pure::Parser:
1380
- # JSON.parser # => JSON::Ext::Parser
1542
+ # Returns the JSON parser class that is used by JSON.
1381
1543
  #
1382
- # source://json//lib/json/common.rb#33
1544
+ # source://json//lib/json/common.rb#37
1383
1545
  def parser; end
1384
1546
 
1385
1547
  # Set the JSON parser class _parser_ to be used by JSON.
1386
1548
  #
1387
- # source://json//lib/json/common.rb#36
1549
+ # source://json//lib/json/common.rb#40
1388
1550
  def parser=(parser); end
1389
1551
 
1390
1552
  # :call-seq:
@@ -1417,56 +1579,425 @@ module JSON
1417
1579
  # }
1418
1580
  # }
1419
1581
  #
1420
- # source://json//lib/json/common.rb#374
1582
+ # source://json//lib/json/common.rb#402
1421
1583
  def pretty_generate(obj, opts = T.unsafe(nil)); end
1422
1584
 
1423
1585
  # :stopdoc:
1424
1586
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1425
1587
  #
1426
- # source://json//lib/json/common.rb#374
1588
+ # source://json//lib/json/common.rb#402
1427
1589
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
1428
1590
 
1429
1591
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1430
1592
  #
1431
- # source://json//lib/json/common.rb#559
1593
+ # source://json//lib/json/common.rb#768
1432
1594
  def recurse_proc(result, &proc); end
1433
1595
 
1434
- # source://json//lib/json/common.rb#541
1596
+ # source://json//lib/json/common.rb#742
1435
1597
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1436
1598
 
1437
- # Sets or Returns the JSON generator state class that is used by JSON. This is
1438
- # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1439
- # JSON.state # => JSON::Ext::Generator::State
1599
+ # Sets or Returns the JSON generator state class that is used by JSON.
1440
1600
  #
1441
- # source://json//lib/json/common.rb#112
1601
+ # source://json//lib/json/common.rb#103
1442
1602
  def state; end
1443
1603
 
1444
- # Sets or Returns the JSON generator state class that is used by JSON. This is
1445
- # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1446
- # JSON.state # => JSON::Ext::Generator::State
1604
+ # Sets or Returns the JSON generator state class that is used by JSON.
1447
1605
  #
1448
- # source://json//lib/json/common.rb#112
1606
+ # source://json//lib/json/common.rb#103
1449
1607
  def state=(_arg0); end
1450
1608
 
1451
1609
  # :stopdoc:
1452
1610
  # I want to deprecate these later, so I'll first be silent about them, and
1453
1611
  # later delete them.
1454
1612
  #
1455
- # source://json//lib/json/common.rb#300
1613
+ # source://json//lib/json/common.rb#329
1456
1614
  def unparse(obj, opts = T.unsafe(nil)); end
1457
1615
 
1458
- private
1616
+ # :call-seq:
1617
+ # JSON.unsafe_load(source, proc = nil, options = {}) -> object
1618
+ #
1619
+ # Returns the Ruby objects created by parsing the given +source+.
1620
+ #
1621
+ # BEWARE: This method is meant to serialise data from trusted user input,
1622
+ # like from your own database server or clients under your control, it could
1623
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1624
+ #
1625
+ # - Argument +source+ must be, or be convertible to, a \String:
1626
+ # - If +source+ responds to instance method +to_str+,
1627
+ # <tt>source.to_str</tt> becomes the source.
1628
+ # - If +source+ responds to instance method +to_io+,
1629
+ # <tt>source.to_io.read</tt> becomes the source.
1630
+ # - If +source+ responds to instance method +read+,
1631
+ # <tt>source.read</tt> becomes the source.
1632
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1633
+ # - Option +allow_blank+ specifies a truthy value.
1634
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1635
+ # - Otherwise, +source+ remains the source.
1636
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1637
+ # It will be called recursively with each result (depth-first order).
1638
+ # See details below.
1639
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1640
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1641
+ # The default options can be changed via method JSON.unsafe_load_default_options=.
1642
+ #
1643
+ # ---
1644
+ #
1645
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1646
+ # <tt>parse(source, opts)</tt>; see #parse.
1647
+ #
1648
+ # Source for following examples:
1649
+ # source = <<~JSON
1650
+ # {
1651
+ # "name": "Dave",
1652
+ # "age" :40,
1653
+ # "hats": [
1654
+ # "Cattleman's",
1655
+ # "Panama",
1656
+ # "Tophat"
1657
+ # ]
1658
+ # }
1659
+ # JSON
1660
+ #
1661
+ # Load a \String:
1662
+ # ruby = JSON.unsafe_load(source)
1663
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1664
+ #
1665
+ # Load an \IO object:
1666
+ # require 'stringio'
1667
+ # object = JSON.unsafe_load(StringIO.new(source))
1668
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1669
+ #
1670
+ # Load a \File object:
1671
+ # path = 't.json'
1672
+ # File.write(path, source)
1673
+ # File.open(path) do |file|
1674
+ # JSON.unsafe_load(file)
1675
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1676
+ #
1677
+ # ---
1678
+ #
1679
+ # When +proc+ is given:
1680
+ # - Modifies +source+ as above.
1681
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1682
+ # - Recursively calls <tt>proc(result)</tt>.
1683
+ # - Returns the final result.
1684
+ #
1685
+ # Example:
1686
+ # require 'json'
1687
+ #
1688
+ # # Some classes for the example.
1689
+ # class Base
1690
+ # def initialize(attributes)
1691
+ # @attributes = attributes
1692
+ # end
1693
+ # end
1694
+ # class User < Base; end
1695
+ # class Account < Base; end
1696
+ # class Admin < Base; end
1697
+ # # The JSON source.
1698
+ # json = <<-EOF
1699
+ # {
1700
+ # "users": [
1701
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1702
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1703
+ # ],
1704
+ # "accounts": [
1705
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1706
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1707
+ # ],
1708
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1709
+ # }
1710
+ # EOF
1711
+ # # Deserializer method.
1712
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1713
+ # type = obj.is_a?(Hash) && obj["type"]
1714
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1715
+ # end
1716
+ # # Call to JSON.unsafe_load
1717
+ # ruby = JSON.unsafe_load(json, proc {|obj|
1718
+ # case obj
1719
+ # when Hash
1720
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1721
+ # when Array
1722
+ # obj.map! {|v| deserialize_obj v }
1723
+ # end
1724
+ # })
1725
+ # pp ruby
1726
+ # Output:
1727
+ # {"users"=>
1728
+ # [#<User:0x00000000064c4c98
1729
+ # @attributes=
1730
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1731
+ # #<User:0x00000000064c4bd0
1732
+ # @attributes=
1733
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1734
+ # "accounts"=>
1735
+ # [{"account"=>
1736
+ # #<Account:0x00000000064c4928
1737
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1738
+ # {"account"=>
1739
+ # #<Account:0x00000000064c4680
1740
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1741
+ # "admins"=>
1742
+ # #<Admin:0x00000000064c41f8
1743
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1744
+ #
1745
+ # source://json//lib/json/common.rb#582
1746
+ def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1747
+
1748
+ # Sets or returns default options for the JSON.unsafe_load method.
1749
+ # Initially:
1750
+ # opts = JSON.load_default_options
1751
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1752
+ #
1753
+ # source://json//lib/json/common.rb#432
1754
+ def unsafe_load_default_options; end
1755
+
1756
+ # Sets or returns default options for the JSON.unsafe_load method.
1757
+ # Initially:
1758
+ # opts = JSON.load_default_options
1759
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1760
+ #
1761
+ # source://json//lib/json/common.rb#432
1762
+ def unsafe_load_default_options=(_arg0); end
1763
+ end
1764
+ end
1765
+
1766
+ # JSON::Coder holds a parser and generator configuration.
1767
+ #
1768
+ # module MyApp
1769
+ # JSONC_CODER = JSON::Coder.new(
1770
+ # allow_trailing_comma: true
1771
+ # )
1772
+ # end
1773
+ #
1774
+ # MyApp::JSONC_CODER.load(document)
1775
+ #
1776
+ # source://json//lib/json/common.rb#870
1777
+ class JSON::Coder
1778
+ # :call-seq:
1779
+ # JSON.new(options = nil, &block)
1780
+ #
1781
+ # Argument +options+, if given, contains a \Hash of options for both parsing and generating.
1782
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options], and {Generating Options}[#module-JSON-label-Generating+Options].
1783
+ #
1784
+ # For generation, the <tt>strict: true</tt> option is always set. When a Ruby object with no native \JSON counterpart is
1785
+ # encoutered, the block provided to the initialize method is invoked, and must return a Ruby object that has a native
1786
+ # \JSON counterpart:
1787
+ #
1788
+ # module MyApp
1789
+ # API_JSON_CODER = JSON::Coder.new do |object|
1790
+ # case object
1791
+ # when Time
1792
+ # object.iso8601(3)
1793
+ # else
1794
+ # object # Unknown type, will raise
1795
+ # end
1796
+ # end
1797
+ # end
1798
+ #
1799
+ # puts MyApp::API_JSON_CODER.dump(Time.now.utc) # => "2025-01-21T08:41:44.286Z"
1800
+ #
1801
+ # @return [Coder] a new instance of Coder
1802
+ #
1803
+ # source://json//lib/json/common.rb#894
1804
+ def initialize(options = T.unsafe(nil), &as_json); end
1805
+
1806
+ # call-seq:
1807
+ # dump(object) -> String
1808
+ # dump(object, io) -> io
1809
+ #
1810
+ # Serialize the given object into a \JSON document.
1811
+ #
1812
+ # source://json//lib/json/common.rb#913
1813
+ def dump(object, io = T.unsafe(nil)); end
1814
+
1815
+ # call-seq:
1816
+ # dump(object) -> String
1817
+ # dump(object, io) -> io
1818
+ #
1819
+ # Serialize the given object into a \JSON document.
1820
+ #
1821
+ # source://json//lib/json/common.rb#913
1822
+ def generate(object, io = T.unsafe(nil)); end
1823
+
1824
+ # call-seq:
1825
+ # load(string) -> Object
1826
+ #
1827
+ # Parse the given \JSON document and return an equivalent Ruby object.
1828
+ #
1829
+ # source://json//lib/json/common.rb#922
1830
+ def load(source); end
1831
+
1832
+ # call-seq:
1833
+ # load(path) -> Object
1834
+ #
1835
+ # Parse the given \JSON document and return an equivalent Ruby object.
1836
+ #
1837
+ # source://json//lib/json/common.rb#931
1838
+ def load_file(path); end
1839
+
1840
+ # call-seq:
1841
+ # load(string) -> Object
1842
+ #
1843
+ # Parse the given \JSON document and return an equivalent Ruby object.
1844
+ #
1845
+ # source://json//lib/json/common.rb#922
1846
+ def parse(source); end
1847
+ end
1848
+
1849
+ module JSON::Ext::Generator::GeneratorMethods::String
1850
+ mixes_in_class_methods ::JSON::Ext::Generator::GeneratorMethods::String::Extend
1851
+ end
1852
+
1853
+ # source://json//lib/json/ext/generator/state.rb#6
1854
+ class JSON::Ext::Generator::State
1855
+ # call-seq: new(opts = {})
1856
+ #
1857
+ # Instantiates a new State object, configured by _opts_.
1858
+ #
1859
+ # _opts_ can have the following keys:
1860
+ #
1861
+ # * *indent*: a string used to indent levels (default: ''),
1862
+ # * *space*: a string that is put after, a : or , delimiter (default: ''),
1863
+ # * *space_before*: a string that is put before a : pair delimiter (default: ''),
1864
+ # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
1865
+ # * *array_nl*: a string that is put at the end of a JSON array (default: ''),
1866
+ # * *allow_nan*: true if NaN, Infinity, and -Infinity should be
1867
+ # generated, otherwise an exception is thrown, if these values are
1868
+ # encountered. This options defaults to false.
1869
+ # * *ascii_only*: true if only ASCII characters should be generated. This
1870
+ # option defaults to false.
1871
+ # * *buffer_initial_length*: sets the initial length of the generator's
1872
+ # internal buffer.
1873
+ #
1874
+ # @return [State] a new instance of State
1875
+ #
1876
+ # source://json//lib/json/ext/generator/state.rb#25
1877
+ def initialize(opts = T.unsafe(nil)); end
1878
+
1879
+ # call-seq: [](name)
1880
+ #
1881
+ # Returns the value returned by method +name+.
1882
+ #
1883
+ # source://json//lib/json/ext/generator/state.rb#84
1884
+ def [](name); end
1885
+
1886
+ # call-seq: []=(name, value)
1887
+ #
1888
+ # Sets the attribute name to value.
1889
+ #
1890
+ # source://json//lib/json/ext/generator/state.rb#96
1891
+ def []=(name, value); end
1459
1892
 
1460
- # source://json//lib/json/common.rb#643
1461
- def merge_dump_options(opts, strict: T.unsafe(nil)); end
1893
+ # call-seq: configure(opts)
1894
+ #
1895
+ # Configure this State instance with the Hash _opts_, and return
1896
+ # itself.
1897
+ #
1898
+ # source://json//lib/json/ext/generator/state.rb#35
1899
+ def configure(opts); end
1900
+
1901
+ # call-seq: configure(opts)
1902
+ #
1903
+ # Configure this State instance with the Hash _opts_, and return
1904
+ # itself.
1905
+ #
1906
+ # source://json//lib/json/ext/generator/state.rb#35
1907
+ def merge(opts); end
1908
+
1909
+ # call-seq: to_h
1910
+ #
1911
+ # Returns the configuration instance variables as a hash, that can be
1912
+ # passed to the configure method.
1913
+ #
1914
+ # source://json//lib/json/ext/generator/state.rb#54
1915
+ def to_h; end
1916
+
1917
+ # call-seq: to_h
1918
+ #
1919
+ # Returns the configuration instance variables as a hash, that can be
1920
+ # passed to the configure method.
1921
+ #
1922
+ # source://json//lib/json/ext/generator/state.rb#54
1923
+ def to_hash; end
1924
+ end
1925
+
1926
+ # source://json//lib/json/ext.rb#9
1927
+ class JSON::Ext::Parser
1928
+ # @return [Parser] a new instance of Parser
1929
+ #
1930
+ # source://json//lib/json/ext.rb#17
1931
+ def initialize(source, opts = T.unsafe(nil)); end
1932
+
1933
+ # source://json//lib/json/ext.rb#26
1934
+ def parse; end
1935
+
1936
+ # source://json//lib/json/ext.rb#22
1937
+ def source; end
1938
+ end
1939
+
1940
+ # source://json//lib/json/ext.rb#32
1941
+ JSON::Ext::Parser::Config = JSON::Ext::ParserConfig
1942
+
1943
+ # Fragment of JSON document that is to be included as is:
1944
+ # fragment = JSON::Fragment.new("[1, 2, 3]")
1945
+ # JSON.generate({ count: 3, items: fragments })
1946
+ #
1947
+ # This allows to easily assemble multiple JSON fragments that have
1948
+ # been persisted somewhere without having to parse them nor resorting
1949
+ # to string interpolation.
1950
+ #
1951
+ # Note: no validation is performed on the provided string. It is the
1952
+ # responsability of the caller to ensure the string contains valid JSON.
1953
+ #
1954
+ # source://json//lib/json/common.rb#183
1955
+ class JSON::Fragment < ::Struct
1956
+ # @return [Fragment] a new instance of Fragment
1957
+ #
1958
+ # source://json//lib/json/common.rb#184
1959
+ def initialize(json); end
1960
+
1961
+ # Returns the value of attribute json
1962
+ #
1963
+ # @return [Object] the current value of json
1964
+ def json; end
1965
+
1966
+ # Sets the attribute json
1967
+ #
1968
+ # @param value [Object] the value to set the attribute json to.
1969
+ # @return [Object] the newly set value
1970
+ def json=(_); end
1971
+
1972
+ # source://json//lib/json/common.rb#192
1973
+ def to_json(state = T.unsafe(nil), *_arg1); end
1974
+
1975
+ class << self
1976
+ def [](*_arg0); end
1977
+ def inspect; end
1978
+ def keyword_init?; end
1979
+ def members; end
1980
+ def new(*_arg0); end
1462
1981
  end
1463
1982
  end
1464
1983
 
1465
- # source://json//lib/json/common.rb#118
1466
- JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1984
+ # This exception is raised if a generator or unparser error occurs.
1985
+ #
1986
+ # source://json//lib/json/common.rb#146
1987
+ class JSON::GeneratorError < ::JSON::JSONError
1988
+ # @return [GeneratorError] a new instance of GeneratorError
1989
+ #
1990
+ # source://json//lib/json/common.rb#149
1991
+ def initialize(message, invalid_object = T.unsafe(nil)); end
1992
+
1993
+ # source://json//lib/json/common.rb#154
1994
+ def detailed_message(*_arg0, **_arg1, &_arg2); end
1467
1995
 
1468
- # source://json//lib/json/common.rb#115
1469
- JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1996
+ # Returns the value of attribute invalid_object.
1997
+ #
1998
+ # source://json//lib/json/common.rb#147
1999
+ def invalid_object; end
2000
+ end
1470
2001
 
1471
2002
  # source://json//lib/json/generic_object.rb#9
1472
2003
  class JSON::GenericObject < ::OpenStruct
@@ -1511,29 +2042,29 @@ end
1511
2042
 
1512
2043
  # The base exception for JSON errors.
1513
2044
  #
1514
- # source://json//lib/json/common.rb#141
2045
+ # source://json//lib/json/common.rb#126
1515
2046
  class JSON::JSONError < ::StandardError
1516
2047
  class << self
1517
- # source://json//lib/json/common.rb#142
2048
+ # source://json//lib/json/common.rb#127
1518
2049
  def wrap(exception); end
1519
2050
  end
1520
2051
  end
1521
2052
 
1522
- # source://json//lib/json/common.rb#7
2053
+ # source://json//lib/json/common.rb#8
1523
2054
  JSON::NOT_SET = T.let(T.unsafe(nil), Object)
1524
2055
 
1525
- # source://json//lib/json/common.rb#39
2056
+ # source://json//lib/json/common.rb#43
1526
2057
  JSON::Parser = JSON::Ext::Parser
1527
2058
 
1528
- # source://json//lib/json/common.rb#77
2059
+ # source://json//lib/json/common.rb#72
1529
2060
  JSON::State = JSON::Ext::Generator::State
1530
2061
 
1531
2062
  # For backwards compatibility
1532
2063
  #
1533
- # source://json//lib/json/common.rb#163
2064
+ # source://json//lib/json/common.rb#167
1534
2065
  JSON::UnparserError = JSON::GeneratorError
1535
2066
 
1536
- # source://json//lib/json/common.rb#653
2067
+ # source://json//lib/json/common.rb#937
1537
2068
  module Kernel
1538
2069
  private
1539
2070
 
@@ -1544,18 +2075,38 @@ module Kernel
1544
2075
  # The _opts_ argument is passed through to generate/parse respectively. See
1545
2076
  # generate and parse for their documentation.
1546
2077
  #
1547
- # source://json//lib/json/common.rb#680
2078
+ # source://json//lib/json/common.rb#964
1548
2079
  def JSON(object, *args); end
1549
2080
 
1550
2081
  # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1551
2082
  # one line.
1552
2083
  #
1553
- # source://json//lib/json/common.rb#658
2084
+ # source://json//lib/json/common.rb#942
1554
2085
  def j(*objs); end
1555
2086
 
1556
2087
  # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1557
2088
  # indentation and over many lines.
1558
2089
  #
1559
- # source://json//lib/json/common.rb#667
2090
+ # source://json//lib/json/common.rb#951
1560
2091
  def jj(*objs); end
1561
2092
  end
2093
+
2094
+ class NilClass
2095
+ include ::JSON::Ext::Generator::GeneratorMethods::NilClass
2096
+ end
2097
+
2098
+ class Object < ::BasicObject
2099
+ include ::Kernel
2100
+ include ::PP::ObjectMixin
2101
+ include ::JSON::Ext::Generator::GeneratorMethods::Object
2102
+ end
2103
+
2104
+ class String
2105
+ include ::Comparable
2106
+ include ::JSON::Ext::Generator::GeneratorMethods::String
2107
+ extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
2108
+ end
2109
+
2110
+ class TrueClass
2111
+ include ::JSON::Ext::Generator::GeneratorMethods::TrueClass
2112
+ end