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 +4 -4
- data/README.md +30 -3
- data/lib/mangrove/result.rb +3 -3
- data/lib/mangrove/version.rb +1 -1
- data/rbi/mangrove.rbi +20 -0
- data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.7.1.rbi} +83 -63
- data/sorbet/rbi/gems/{prism@0.15.1.rbi → prism@0.18.0.rbi} +8899 -4119
- data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.7.3.rbi} +35 -35
- data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +206 -63
- data/sorbet/rbi/gems/{rbi@0.1.3.rbi → rbi@0.1.5.rbi} +25 -25
- data/sorbet/rbi/gems/{rdoc@6.6.0.rbi → rdoc@6.6.1.rbi} +130 -127
- data/sorbet/rbi/gems/{regexp_parser@2.8.2.rbi → regexp_parser@2.8.3.rbi} +37 -37
- data/sorbet/rbi/gems/{rubocop-ast@1.29.0.rbi → rubocop-ast@1.30.0.rbi} +249 -225
- data/sorbet/rbi/gems/{rubocop-rspec@2.24.1.rbi → rubocop-rspec@2.25.0.rbi} +39 -33
- data/sorbet/rbi/gems/{rubocop@1.57.1.rbi → rubocop@1.59.0.rbi} +1146 -686
- data/sorbet/rbi/gems/{tapioca@0.11.10.rbi → tapioca@0.11.13.rbi} +65 -65
- metadata +20 -20
- data/sorbet/rbi/gems/base64@0.1.1.rbi +0 -172
- data/sorbet/rbi/gems/irb@1.9.0.rbi +0 -342
- /data/sorbet/rbi/gems/{io-console@0.6.0.rbi → io-console@0.7.0.rbi} +0 -0
- /data/sorbet/rbi/gems/{reline@0.4.0.rbi → reline@0.4.1.rbi} +0 -0
- /data/sorbet/rbi/gems/{ruby-lsp@0.12.0.rbi → ruby-lsp@0.13.1.rbi} +0 -0
- /data/sorbet/rbi/gems/{stringio@3.0.9.rbi → stringio@3.1.0.rbi} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 664bbac8105d664cdea4ffc16072f956cc8268eedaccdd5b22082a84acc3d26e
|
4
|
+
data.tar.gz: e905b62cf22c734639f085c421d5c3d4fd76612187c7e3abdcadc336b8dd387a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/mangrove/result.rb
CHANGED
@@ -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
|
data/lib/mangrove/version.rb
CHANGED
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:
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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, :
|
1051
|
+
# opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
|
1040
1052
|
#
|
1041
|
-
# source://json//lib/json/common.rb#
|
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, :
|
1059
|
+
# opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
|
1048
1060
|
#
|
1049
|
-
# source://json//lib/json/common.rb#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
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#
|
1533
|
+
# source://json//lib/json/common.rb#162
|
1514
1534
|
JSON::UnparserError = JSON::GeneratorError
|
1515
1535
|
|
1516
|
-
# source://json//lib/json/common.rb#
|
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#
|
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#
|
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#
|
1559
|
+
# source://json//lib/json/common.rb#666
|
1540
1560
|
def jj(*objs); end
|
1541
1561
|
end
|