mangrove 0.24.0 → 0.29.0

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: aa2f22dcbb9d2f0da9e28c414cb0c5031ca0e85efae1fb1ff43f9f7fedb27467
4
- data.tar.gz: ee48cde475b14fd8d1f558b77b9208c597d39ed6e94280008c08b722bc870ad2
3
+ metadata.gz: 664bbac8105d664cdea4ffc16072f956cc8268eedaccdd5b22082a84acc3d26e
4
+ data.tar.gz: e905b62cf22c734639f085c421d5c3d4fd76612187c7e3abdcadc336b8dd387a
5
5
  SHA512:
6
- metadata.gz: bc8872e6bc079a3ff532212477cced1f87f09fc0f600c0a6a2abad0ce4ba46689dcafda6f9ec7519f33b76c45cdc0bfde527c60f85a25cbea069d3c68e64d981
7
- data.tar.gz: 22092ce2f3907e1419efb6686e5fd588ed39d37d40f6fa1a0a5b446655fd2e90e6466cace05ec7e993b3d2d57bc1a994698d531c2fe7102cfc6f016f5164134f
6
+ metadata.gz: fe4154f82a4c9d2a5cdba0470f7eae09a1fec76dc0b03f562b90b101bfacfa5cf5c47b2463935c066aa5630a6a4ec070d2dbe7d89c22aa18e4a1b283d783e292
7
+ data.tar.gz: e9ca01c44f84ce9e9ae2d633ea4db4ec2315045bef47ce4cc8a5d52c3cf7b0db18f5f75687e4d5daf34454518b13004926e5d718039f71ba8084736258e806e5
data/README.md CHANGED
@@ -1,14 +1,12 @@
1
1
  # Mangrove
2
- Mangrove provides type utility to use with Sorbet.
3
2
 
4
3
  Mangrove is a Ruby Gem designed to be the definitive toolkit for leveraging Sorbet's type system in Ruby applications. It's designed to offer a robust, statically-typed experience, focusing on solid types, a functional programming style, and an interface-driven approach.
5
4
 
6
- Use `rubocop-mangrove` to statically check rescuing ControlSignal is done
7
-
8
5
  - [Documentation](https://kazzix14.github.io/mangrove/docs/)
9
6
  - [Coverage](https://kazzix14.github.io/mangrove/coverage/index.html#_AllFiles)
10
7
 
11
8
  ## Features
9
+
12
10
  - Option Type
13
11
  - Result Type
14
12
  - Enums with inner types (ADTs)
@@ -36,9 +34,38 @@ my_ok = Result::Ok.new("my value")
36
34
  my_err = Result::Err.new("my err")
37
35
  my_some = Option::Some.new(1234)
38
36
  my_none = Option::None.new
37
+
38
+ ##############################
39
+
40
+ response = MyClient
41
+ .new
42
+ .and_then { |client| client.get_response() }
43
+ .and_then { |response| response.body }
44
+
45
+ case response
46
+ when Mangrove::Result::Ok
47
+ puts response.ok_inner
48
+ when Mangrove::Result::Err
49
+ puts response.err_inner
50
+ end
51
+
52
+ ##############################
53
+
54
+ class MyEnum
55
+ extend Mangrove::Enum
56
+
57
+ variants do
58
+ variant VariantWithInteger, Integer
59
+ variant VariantWithString, String
60
+ variant VariantWithException, Exception
61
+ variant VariantWithTuple, [Integer, String]
62
+ variant VariantWithShape, { name: String, age: Integer }
63
+ end
64
+ end
39
65
  ```
40
66
 
41
67
  ## Commands for Development
68
+
42
69
  ```
43
70
  git config core.hooksPath hooks
44
71
  bundle install
@@ -51,7 +51,7 @@ module Mangrove
51
51
  sig { abstract.type_parameters(:NewOkType, :NewErrType).params(block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
52
52
  def map(&block); end
53
53
 
54
- sig { abstract.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T.type_parameter(:NewOkType), _t_new_err: T.type_parameter(:NewErrType), block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
54
+ sig { abstract.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T::Class[T.type_parameter(:NewOkType)], _t_new_err: T::Class[T.type_parameter(:NewErrType)], block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
55
55
  def map_wt(_t_new_ok, _t_new_err, &block); end
56
56
 
57
57
  sig { abstract.type_parameters(:NewOkType).params(block: T.proc.params(this: OkType).returns(T.type_parameter(:NewOkType))).returns(Result[T.type_parameter(:NewOkType), ErrType]) }
@@ -225,7 +225,7 @@ module Mangrove
225
225
  block.call(self)
226
226
  end
227
227
 
228
- sig { override.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T.type_parameter(:NewOkType), _t_new_err: T.type_parameter(:NewErrType), block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
228
+ sig { override.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T::Class[T.type_parameter(:NewOkType)], _t_new_err: T::Class[T.type_parameter(:NewErrType)], block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
229
229
  def map_wt(_t_new_ok, _t_new_err, &block)
230
230
  block.call(self)
231
231
  end
@@ -396,7 +396,7 @@ module Mangrove
396
396
  block.call(self)
397
397
  end
398
398
 
399
- sig { override.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T.type_parameter(:NewOkType), _t_new_err: T.type_parameter(:NewErrType), block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
399
+ sig { override.type_parameters(:NewOkType, :NewErrType).params(_t_new_ok: T::Class[T.type_parameter(:NewOkType)], _t_new_err: T::Class[T.type_parameter(:NewErrType)], block: T.proc.params(this: Result[OkType, ErrType]).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)])).returns(Result[T.type_parameter(:NewOkType), T.type_parameter(:NewErrType)]) }
400
400
  def map_wt(_t_new_ok, _t_new_err, &block)
401
401
  block.call(self)
402
402
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Mangrove
5
- VERSION = "0.24.0"
5
+ VERSION = "0.29.0"
6
6
  end
data/rbi/mangrove.rbi ADDED
@@ -0,0 +1,20 @@
1
+ # typed: true
2
+
3
+ module Mangrove
4
+ # Result is a type that represents either success (`Ok`) or failure (`Err`).
5
+ module Result
6
+ class Err
7
+ class << self
8
+ sig { type_parameters(:ErrType).params(inner: T.type_parameter(:ErrType)).returns(Mangrove::Result::Err[T.untyped, T.type_parameter(:ErrType)]) }
9
+ def new(inner); end
10
+ end
11
+ end
12
+
13
+ class Ok
14
+ class << self
15
+ sig { type_parameters(:OkType).params(inner: T.type_parameter(:OkType)).returns(Mangrove::Result::Ok[T.type_parameter(:OkType), T.untyped]) }
16
+ def new(inner); end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: false
2
2
 
3
3
  # DO NOT EDIT MANUALLY
4
4
  # This is an autogenerated file for types exported from the `json` gem.
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Extends any Class to include _json_creatable?_ method.
8
8
  #
9
- # source://json//lib/json/common.rb#695
9
+ # source://json//lib/json/common.rb#689
10
10
  class Class < ::Module
11
11
  # Returns true if this class can be used to create an instance
12
12
  # from a serialised JSON string. The class has to implement a class
@@ -15,7 +15,7 @@ class Class < ::Module
15
15
  #
16
16
  # @return [Boolean]
17
17
  #
18
- # source://json//lib/json/common.rb#700
18
+ # source://json//lib/json/common.rb#694
19
19
  def json_creatable?; end
20
20
  end
21
21
 
@@ -302,6 +302,15 @@ end
302
302
  # # Raises JSON::NestingError (nesting of 2 is too deep):
303
303
  # JSON.generate(obj, max_nesting: 2)
304
304
  #
305
+ # ====== Escaping Options
306
+ #
307
+ # Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt>
308
+ # and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script
309
+ # tags.
310
+ #
311
+ # Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range
312
+ # should be escaped.
313
+ #
305
314
  # ====== Output Options
306
315
  #
307
316
  # The default formatting options generate the most compact
@@ -621,8 +630,8 @@ module JSON
621
630
  # Output:
622
631
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
623
632
  #
624
- # source://json//lib/json/common.rb#631
625
- def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil)); end
633
+ # source://json//lib/json/common.rb#614
634
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
626
635
 
627
636
  # :call-seq:
628
637
  # JSON.fast_generate(obj, opts) -> new_string
@@ -638,13 +647,13 @@ module JSON
638
647
  # # Raises SystemStackError (stack level too deep):
639
648
  # JSON.fast_generate(a)
640
649
  #
641
- # source://json//lib/json/common.rb#335
650
+ # source://json//lib/json/common.rb#328
642
651
  def fast_generate(obj, opts = T.unsafe(nil)); end
643
652
 
644
653
  # :stopdoc:
645
654
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
646
655
  #
647
- # source://json//lib/json/common.rb#335
656
+ # source://json//lib/json/common.rb#328
648
657
  def fast_unparse(obj, opts = T.unsafe(nil)); end
649
658
 
650
659
  # :call-seq:
@@ -683,7 +692,7 @@ module JSON
683
692
  # # Raises JSON::NestingError (nesting of 100 is too deep):
684
693
  # JSON.generate(a)
685
694
  #
686
- # source://json//lib/json/common.rb#296
695
+ # source://json//lib/json/common.rb#299
687
696
  def generate(obj, opts = T.unsafe(nil)); end
688
697
 
689
698
  # :call-seq:
@@ -814,7 +823,7 @@ module JSON
814
823
  # #<Admin:0x00000000064c41f8
815
824
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
816
825
  #
817
- # source://json//lib/json/common.rb#557
826
+ # source://json//lib/json/common.rb#540
818
827
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
819
828
 
820
829
  # :call-seq:
@@ -825,7 +834,7 @@ module JSON
825
834
  #
826
835
  # See method #parse.
827
836
  #
828
- # source://json//lib/json/common.rb#245
837
+ # source://json//lib/json/common.rb#248
829
838
  def load_file(filespec, opts = T.unsafe(nil)); end
830
839
 
831
840
  # :call-seq:
@@ -836,9 +845,12 @@ module JSON
836
845
  #
837
846
  # See method #parse!
838
847
  #
839
- # source://json//lib/json/common.rb#256
848
+ # source://json//lib/json/common.rb#259
840
849
  def load_file!(filespec, opts = T.unsafe(nil)); end
841
850
 
851
+ # source://json//lib/json/common.rb#642
852
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
853
+
842
854
  # :call-seq:
843
855
  # JSON.parse(source, opts) -> object
844
856
  #
@@ -887,7 +899,7 @@ module JSON
887
899
  # # Raises JSON::ParserError (783: unexpected token at ''):
888
900
  # JSON.parse('')
889
901
  #
890
- # source://json//lib/json/common.rb#215
902
+ # source://json//lib/json/common.rb#218
891
903
  def parse(source, opts = T.unsafe(nil)); end
892
904
 
893
905
  # :call-seq:
@@ -902,7 +914,7 @@ module JSON
902
914
  # which disables checking for nesting depth.
903
915
  # - Option +allow_nan+, if not provided, defaults to +true+.
904
916
  #
905
- # source://json//lib/json/common.rb#230
917
+ # source://json//lib/json/common.rb#233
906
918
  def parse!(source, opts = T.unsafe(nil)); end
907
919
 
908
920
  # :call-seq:
@@ -935,28 +947,28 @@ module JSON
935
947
  # }
936
948
  # }
937
949
  #
938
- # source://json//lib/json/common.rb#390
950
+ # source://json//lib/json/common.rb#373
939
951
  def pretty_generate(obj, opts = T.unsafe(nil)); end
940
952
 
941
953
  # :stopdoc:
942
954
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
943
955
  #
944
- # source://json//lib/json/common.rb#390
956
+ # source://json//lib/json/common.rb#373
945
957
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
946
958
 
947
959
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
948
960
  #
949
- # source://json//lib/json/common.rb#575
961
+ # source://json//lib/json/common.rb#558
950
962
  def recurse_proc(result, &proc); end
951
963
 
952
- # source://json//lib/json/common.rb#557
964
+ # source://json//lib/json/common.rb#540
953
965
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
954
966
 
955
967
  # :stopdoc:
956
968
  # I want to deprecate these later, so I'll first be silent about them, and
957
969
  # later delete them.
958
970
  #
959
- # source://json//lib/json/common.rb#296
971
+ # source://json//lib/json/common.rb#299
960
972
  def unparse(obj, opts = T.unsafe(nil)); end
961
973
 
962
974
  class << self
@@ -972,26 +984,26 @@ module JSON
972
984
  # ruby = [0, 1, nil]
973
985
  # JSON[ruby] # => '[0,1,null]'
974
986
  #
975
- # source://json//lib/json/common.rb#18
987
+ # source://json//lib/json/common.rb#21
976
988
  def [](object, opts = T.unsafe(nil)); end
977
989
 
978
- # source://json//lib/json/common.rb#81
990
+ # source://json//lib/json/common.rb#84
979
991
  def create_fast_state; end
980
992
 
981
993
  # Returns the current create identifier.
982
994
  # See also JSON.create_id=.
983
995
  #
984
- # source://json//lib/json/common.rb#126
996
+ # source://json//lib/json/common.rb#129
985
997
  def create_id; end
986
998
 
987
999
  # Sets create identifier, which is used to decide if the _json_create_
988
1000
  # hook of a class should be called; initial value is +json_class+:
989
1001
  # JSON.create_id # => 'json_class'
990
1002
  #
991
- # source://json//lib/json/common.rb#120
1003
+ # source://json//lib/json/common.rb#123
992
1004
  def create_id=(new_value); end
993
1005
 
994
- # source://json//lib/json/common.rb#91
1006
+ # source://json//lib/json/common.rb#94
995
1007
  def create_pretty_state; end
996
1008
 
997
1009
  # Return the constant located at _path_. The format of _path_ has to be
@@ -999,7 +1011,7 @@ module JSON
999
1011
  # level (absolute namespace path?). If there doesn't exist a constant at
1000
1012
  # the given path, an ArgumentError is raised.
1001
1013
  #
1002
- # source://json//lib/json/common.rb#42
1014
+ # source://json//lib/json/common.rb#45
1003
1015
  def deep_const_get(path); end
1004
1016
 
1005
1017
  # :call-seq:
@@ -1030,23 +1042,23 @@ module JSON
1030
1042
  # Output:
1031
1043
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1032
1044
  #
1033
- # source://json//lib/json/common.rb#631
1034
- def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil)); end
1045
+ # source://json//lib/json/common.rb#614
1046
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1035
1047
 
1036
1048
  # Sets or returns the default options for the JSON.dump method.
1037
1049
  # Initially:
1038
1050
  # opts = JSON.dump_default_options
1039
- # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1051
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1040
1052
  #
1041
- # source://json//lib/json/common.rb#596
1053
+ # source://json//lib/json/common.rb#579
1042
1054
  def dump_default_options; end
1043
1055
 
1044
1056
  # Sets or returns the default options for the JSON.dump method.
1045
1057
  # Initially:
1046
1058
  # opts = JSON.dump_default_options
1047
- # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1059
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1048
1060
  #
1049
- # source://json//lib/json/common.rb#596
1061
+ # source://json//lib/json/common.rb#579
1050
1062
  def dump_default_options=(_arg0); end
1051
1063
 
1052
1064
  # :call-seq:
@@ -1063,13 +1075,13 @@ module JSON
1063
1075
  # # Raises SystemStackError (stack level too deep):
1064
1076
  # JSON.fast_generate(a)
1065
1077
  #
1066
- # source://json//lib/json/common.rb#335
1078
+ # source://json//lib/json/common.rb#328
1067
1079
  def fast_generate(obj, opts = T.unsafe(nil)); end
1068
1080
 
1069
1081
  # :stopdoc:
1070
1082
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1071
1083
  #
1072
- # source://json//lib/json/common.rb#335
1084
+ # source://json//lib/json/common.rb#328
1073
1085
  def fast_unparse(obj, opts = T.unsafe(nil)); end
1074
1086
 
1075
1087
  # :call-seq:
@@ -1108,24 +1120,24 @@ module JSON
1108
1120
  # # Raises JSON::NestingError (nesting of 100 is too deep):
1109
1121
  # JSON.generate(a)
1110
1122
  #
1111
- # source://json//lib/json/common.rb#296
1123
+ # source://json//lib/json/common.rb#299
1112
1124
  def generate(obj, opts = T.unsafe(nil)); end
1113
1125
 
1114
1126
  # Returns the JSON generator module that is used by JSON. This is
1115
1127
  # either JSON::Ext::Generator or JSON::Pure::Generator:
1116
1128
  # JSON.generator # => JSON::Ext::Generator
1117
1129
  #
1118
- # source://json//lib/json/common.rb#103
1130
+ # source://json//lib/json/common.rb#106
1119
1131
  def generator; end
1120
1132
 
1121
1133
  # Set the module _generator_ to be used by JSON.
1122
1134
  #
1123
- # source://json//lib/json/common.rb#58
1135
+ # source://json//lib/json/common.rb#61
1124
1136
  def generator=(generator); end
1125
1137
 
1126
1138
  # Encodes string using String.encode.
1127
1139
  #
1128
- # source://json//lib/json/common.rb#653
1140
+ # source://json//lib/json/common.rb#638
1129
1141
  def iconv(to, from, string); end
1130
1142
 
1131
1143
  # :call-seq:
@@ -1256,7 +1268,7 @@ module JSON
1256
1268
  # #<Admin:0x00000000064c41f8
1257
1269
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1258
1270
  #
1259
- # source://json//lib/json/common.rb#557
1271
+ # source://json//lib/json/common.rb#540
1260
1272
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1261
1273
 
1262
1274
  # Sets or returns default options for the JSON.load method.
@@ -1264,7 +1276,7 @@ module JSON
1264
1276
  # opts = JSON.load_default_options
1265
1277
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1266
1278
  #
1267
- # source://json//lib/json/common.rb#420
1279
+ # source://json//lib/json/common.rb#403
1268
1280
  def load_default_options; end
1269
1281
 
1270
1282
  # Sets or returns default options for the JSON.load method.
@@ -1272,7 +1284,7 @@ module JSON
1272
1284
  # opts = JSON.load_default_options
1273
1285
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1274
1286
  #
1275
- # source://json//lib/json/common.rb#420
1287
+ # source://json//lib/json/common.rb#403
1276
1288
  def load_default_options=(_arg0); end
1277
1289
 
1278
1290
  # :call-seq:
@@ -1283,7 +1295,7 @@ module JSON
1283
1295
  #
1284
1296
  # See method #parse.
1285
1297
  #
1286
- # source://json//lib/json/common.rb#245
1298
+ # source://json//lib/json/common.rb#248
1287
1299
  def load_file(filespec, opts = T.unsafe(nil)); end
1288
1300
 
1289
1301
  # :call-seq:
@@ -1294,7 +1306,7 @@ module JSON
1294
1306
  #
1295
1307
  # See method #parse!
1296
1308
  #
1297
- # source://json//lib/json/common.rb#256
1309
+ # source://json//lib/json/common.rb#259
1298
1310
  def load_file!(filespec, opts = T.unsafe(nil)); end
1299
1311
 
1300
1312
  # :call-seq:
@@ -1345,7 +1357,7 @@ module JSON
1345
1357
  # # Raises JSON::ParserError (783: unexpected token at ''):
1346
1358
  # JSON.parse('')
1347
1359
  #
1348
- # source://json//lib/json/common.rb#215
1360
+ # source://json//lib/json/common.rb#218
1349
1361
  def parse(source, opts = T.unsafe(nil)); end
1350
1362
 
1351
1363
  # :call-seq:
@@ -1360,19 +1372,19 @@ module JSON
1360
1372
  # which disables checking for nesting depth.
1361
1373
  # - Option +allow_nan+, if not provided, defaults to +true+.
1362
1374
  #
1363
- # source://json//lib/json/common.rb#230
1375
+ # source://json//lib/json/common.rb#233
1364
1376
  def parse!(source, opts = T.unsafe(nil)); end
1365
1377
 
1366
1378
  # Returns the JSON parser class that is used by JSON. This is either
1367
1379
  # JSON::Ext::Parser or JSON::Pure::Parser:
1368
1380
  # JSON.parser # => JSON::Ext::Parser
1369
1381
  #
1370
- # source://json//lib/json/common.rb#29
1382
+ # source://json//lib/json/common.rb#32
1371
1383
  def parser; end
1372
1384
 
1373
1385
  # Set the JSON parser class _parser_ to be used by JSON.
1374
1386
  #
1375
- # source://json//lib/json/common.rb#32
1387
+ # source://json//lib/json/common.rb#35
1376
1388
  def parser=(parser); end
1377
1389
 
1378
1390
  # :call-seq:
@@ -1405,50 +1417,55 @@ module JSON
1405
1417
  # }
1406
1418
  # }
1407
1419
  #
1408
- # source://json//lib/json/common.rb#390
1420
+ # source://json//lib/json/common.rb#373
1409
1421
  def pretty_generate(obj, opts = T.unsafe(nil)); end
1410
1422
 
1411
1423
  # :stopdoc:
1412
1424
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1413
1425
  #
1414
- # source://json//lib/json/common.rb#390
1426
+ # source://json//lib/json/common.rb#373
1415
1427
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
1416
1428
 
1417
1429
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1418
1430
  #
1419
- # source://json//lib/json/common.rb#575
1431
+ # source://json//lib/json/common.rb#558
1420
1432
  def recurse_proc(result, &proc); end
1421
1433
 
1422
- # source://json//lib/json/common.rb#557
1434
+ # source://json//lib/json/common.rb#540
1423
1435
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1424
1436
 
1425
1437
  # Sets or Returns the JSON generator state class that is used by JSON. This is
1426
1438
  # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1427
1439
  # JSON.state # => JSON::Ext::Generator::State
1428
1440
  #
1429
- # source://json//lib/json/common.rb#108
1441
+ # source://json//lib/json/common.rb#111
1430
1442
  def state; end
1431
1443
 
1432
1444
  # Sets or Returns the JSON generator state class that is used by JSON. This is
1433
1445
  # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1434
1446
  # JSON.state # => JSON::Ext::Generator::State
1435
1447
  #
1436
- # source://json//lib/json/common.rb#108
1448
+ # source://json//lib/json/common.rb#111
1437
1449
  def state=(_arg0); end
1438
1450
 
1439
1451
  # :stopdoc:
1440
1452
  # I want to deprecate these later, so I'll first be silent about them, and
1441
1453
  # later delete them.
1442
1454
  #
1443
- # source://json//lib/json/common.rb#296
1455
+ # source://json//lib/json/common.rb#299
1444
1456
  def unparse(obj, opts = T.unsafe(nil)); end
1457
+
1458
+ private
1459
+
1460
+ # source://json//lib/json/common.rb#642
1461
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
1445
1462
  end
1446
1463
  end
1447
1464
 
1448
- # source://json//lib/json/common.rb#114
1465
+ # source://json//lib/json/common.rb#117
1449
1466
  JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1450
1467
 
1451
- # source://json//lib/json/common.rb#111
1468
+ # source://json//lib/json/common.rb#114
1452
1469
  JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1453
1470
 
1454
1471
  # source://json//lib/json/generic_object.rb#5
@@ -1494,26 +1511,29 @@ end
1494
1511
 
1495
1512
  # The base exception for JSON errors.
1496
1513
  #
1497
- # source://json//lib/json/common.rb#137
1514
+ # source://json//lib/json/common.rb#140
1498
1515
  class JSON::JSONError < ::StandardError
1499
1516
  class << self
1500
- # source://json//lib/json/common.rb#138
1517
+ # source://json//lib/json/common.rb#141
1501
1518
  def wrap(exception); end
1502
1519
  end
1503
1520
  end
1504
1521
 
1505
- # source://json//lib/json/common.rb#35
1522
+ # source://json//lib/json/common.rb#6
1523
+ JSON::NOT_SET = T.let(T.unsafe(nil), Object)
1524
+
1525
+ # source://json//lib/json/common.rb#38
1506
1526
  JSON::Parser = JSON::Ext::Parser
1507
1527
 
1508
- # source://json//lib/json/common.rb#73
1528
+ # source://json//lib/json/common.rb#76
1509
1529
  JSON::State = JSON::Ext::Generator::State
1510
1530
 
1511
1531
  # For backwards compatibility
1512
1532
  #
1513
- # source://json//lib/json/common.rb#159
1533
+ # source://json//lib/json/common.rb#162
1514
1534
  JSON::UnparserError = JSON::GeneratorError
1515
1535
 
1516
- # source://json//lib/json/common.rb#658
1536
+ # source://json//lib/json/common.rb#652
1517
1537
  module Kernel
1518
1538
  private
1519
1539
 
@@ -1524,18 +1544,18 @@ module Kernel
1524
1544
  # The _opts_ argument is passed through to generate/parse respectively. See
1525
1545
  # generate and parse for their documentation.
1526
1546
  #
1527
- # source://json//lib/json/common.rb#685
1547
+ # source://json//lib/json/common.rb#679
1528
1548
  def JSON(object, *args); end
1529
1549
 
1530
1550
  # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1531
1551
  # one line.
1532
1552
  #
1533
- # source://json//lib/json/common.rb#663
1553
+ # source://json//lib/json/common.rb#657
1534
1554
  def j(*objs); end
1535
1555
 
1536
1556
  # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1537
1557
  # indentation and over many lines.
1538
1558
  #
1539
- # source://json//lib/json/common.rb#672
1559
+ # source://json//lib/json/common.rb#666
1540
1560
  def jj(*objs); end
1541
1561
  end