openfeature-sdk-sorbet 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -1
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -1
  5. data/CHANGELOG.md +12 -3
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +55 -49
  8. data/README.md +23 -6
  9. data/lib/open_feature/client.rb +90 -32
  10. data/lib/open_feature/client_metadata.rb +1 -0
  11. data/lib/open_feature/evaluation_context.rb +2 -2
  12. data/lib/open_feature/evaluation_details.rb +2 -2
  13. data/lib/open_feature/hook.rb +41 -1
  14. data/lib/open_feature/hook_context.rb +30 -0
  15. data/lib/open_feature/hooks.rb +22 -0
  16. data/lib/open_feature/multiple_source_provider.rb +28 -12
  17. data/lib/open_feature/no_op_provider.rb +2 -3
  18. data/lib/open_feature/provider.rb +16 -2
  19. data/lib/open_feature/provider_status.rb +13 -0
  20. data/lib/open_feature.rb +9 -2
  21. data/sorbet/rbi/gems/.gitattributes +1 -0
  22. data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.7.1.rbi} +80 -60
  23. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  24. data/sorbet/rbi/gems/{minitest@5.18.0.rbi → minitest@5.21.2.rbi} +299 -258
  25. data/sorbet/rbi/gems/{parallel@1.23.0.rbi → parallel@1.24.0.rbi} +8 -1
  26. data/sorbet/rbi/gems/{parser@3.2.2.1.rbi → parser@3.3.0.5.rbi} +438 -2219
  27. data/sorbet/rbi/gems/prism@0.19.0.rbi +25199 -0
  28. data/sorbet/rbi/gems/psych@5.1.2.rbi +1731 -0
  29. data/sorbet/rbi/gems/racc@1.7.3.rbi +157 -0
  30. data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +68 -65
  31. data/sorbet/rbi/gems/{rbi@0.0.16.rbi → rbi@0.1.6.rbi} +628 -755
  32. data/sorbet/rbi/gems/{regexp_parser@2.8.0.rbi → regexp_parser@2.9.0.rbi} +203 -180
  33. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.2.6.rbi} +116 -52
  34. data/sorbet/rbi/gems/{rubocop-ast@1.28.1.rbi → rubocop-ast@1.30.0.rbi} +178 -84
  35. data/sorbet/rbi/gems/{rubocop-minitest@0.31.0.rbi → rubocop-minitest@0.34.5.rbi} +280 -232
  36. data/sorbet/rbi/gems/{rubocop-performance@1.17.1.rbi → rubocop-performance@1.20.2.rbi} +397 -172
  37. data/sorbet/rbi/gems/{rubocop-sorbet@0.7.0.rbi → rubocop-sorbet@0.7.6.rbi} +728 -261
  38. data/sorbet/rbi/gems/{rubocop@1.51.0.rbi → rubocop@1.60.2.rbi} +4006 -1936
  39. data/sorbet/rbi/gems/spoom@1.2.1.rbi +17 -56
  40. data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
  41. data/sorbet/rbi/gems/{tapioca@0.11.6.rbi → tapioca@0.11.17.rbi} +778 -576
  42. data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.3.0.rbi} +775 -395
  43. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +1 -1
  44. data/sorbet/rbi/gems/yard@0.9.34.rbi +2 -2
  45. data/sorbet/rbi/gems/{zeitwerk@2.6.8.rbi → zeitwerk@2.6.12.rbi} +78 -67
  46. data/sorbet/tapioca/config.yml +2 -2
  47. data/sorbet/tapioca/require.rb +3 -1
  48. metadata +36 -31
  49. data/openfeature-sdk-sorbet.gemspec +0 -35
  50. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
  51. data/sorbet/rbi/gems/irb@1.6.4.rbi +0 -342
  52. data/sorbet/rbi/gems/unparser@0.6.7.rbi +0 -4524
  53. /data/sorbet/rbi/gems/{io-console@0.6.0.rbi → io-console@0.7.2.rbi} +0 -0
  54. /data/sorbet/rbi/gems/{reline@0.3.3.rbi → reline@0.4.2.rbi} +0 -0
  55. /data/sorbet/rbi/gems/{unicode-display_width@2.4.2.rbi → unicode-display_width@2.5.0.rbi} +0 -0
@@ -0,0 +1,22 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module OpenFeature
5
+ # Represents full set of hooks with helper methods for filtering and sequencing each subtype
6
+ class Hooks < T::Struct
7
+ extend T::Generic
8
+ extend T::Sig
9
+ const :global, T::Array[Hook], default: []
10
+ const :provider, T::Array[Hook], default: []
11
+ const :client, T::Array[Hook], default: []
12
+ const :invocation, T::Array[Hook], default: []
13
+
14
+ # See Requirement 4.4.2
15
+ # TODO: when there is >1 subtype of hook will need to filter and not simply re-cast
16
+ # ACHTUNG! T.cast is safe for now but will need to be updated after ^
17
+ sig { returns(T::Array[Hook::BeforeHook]) }
18
+ def before
19
+ T.cast(global + client + invocation + provider, T::Array[Hook::BeforeHook])
20
+ end
21
+ end
22
+ end
@@ -7,19 +7,18 @@ module OpenFeature
7
7
  # The providers will be evaluated in that order and the first
8
8
  # non-error result will be used. If all sources return an error
9
9
  # then the default value is used.
10
- class MultipleSourceProvider
10
+ class MultipleSourceProvider < Provider
11
11
  extend T::Sig
12
12
 
13
- include Provider
14
-
15
13
  sig { params(providers: T::Array[Provider]).void }
16
14
  def initialize(providers:)
17
15
  @providers = providers
16
+ super(ProviderStatus::NotReady)
18
17
  end
19
18
 
20
19
  sig { override.returns(ProviderMetadata) }
21
20
  def metadata
22
- ProviderMetadata.new(name: "Multiple Sources: #{providers.map(&:metadata).map(&:name).join(", ")}")
21
+ ProviderMetadata.new(name: "Multiple Sources: #{providers.map { |provider| provider.metadata.name }.join(", ")}")
23
22
  end
24
23
 
25
24
  sig { override.returns(T::Array[Hook]) }
@@ -27,6 +26,23 @@ module OpenFeature
27
26
  providers.flat_map(&:hooks)
28
27
  end
29
28
 
29
+ sig { override.params(context: EvaluationContext).void }
30
+ def init(context:)
31
+ providers.each { |provider| provider.init(context:) }
32
+ @status = if providers.all? { |provider| provider.status == ProviderStatus::Ready }
33
+ ProviderStatus::Ready
34
+ else
35
+ ProviderStatus::Error
36
+ end
37
+ rescue StandardError
38
+ @status = ProviderStatus::Error
39
+ end
40
+
41
+ sig { override.void }
42
+ def shutdown
43
+ providers.each(&:shutdown)
44
+ end
45
+
30
46
  sig do
31
47
  override
32
48
  .params(
@@ -37,8 +53,8 @@ module OpenFeature
37
53
  .returns(ResolutionDetails[T::Boolean])
38
54
  end
39
55
  def resolve_boolean_value(flag_key:, default_value:, context: nil)
40
- resolve_from_sources(default_value: default_value) do |provider|
41
- provider.resolve_boolean_value(flag_key: flag_key, default_value: default_value, context: context)
56
+ resolve_from_sources(default_value:) do |provider|
57
+ provider.resolve_boolean_value(flag_key:, default_value:)
42
58
  end
43
59
  end
44
60
 
@@ -52,8 +68,8 @@ module OpenFeature
52
68
  .returns(ResolutionDetails[Numeric])
53
69
  end
54
70
  def resolve_number_value(flag_key:, default_value:, context: nil)
55
- resolve_from_sources(default_value: default_value) do |provider|
56
- provider.resolve_number_value(flag_key: flag_key, default_value: default_value, context: context)
71
+ resolve_from_sources(default_value:) do |provider|
72
+ provider.resolve_number_value(flag_key:, default_value:)
57
73
  end
58
74
  end
59
75
 
@@ -67,8 +83,8 @@ module OpenFeature
67
83
  .returns(ResolutionDetails[Structure])
68
84
  end
69
85
  def resolve_structure_value(flag_key:, default_value:, context: nil)
70
- resolve_from_sources(default_value: default_value) do |provider|
71
- provider.resolve_structure_value(flag_key: flag_key, default_value: default_value, context: context)
86
+ resolve_from_sources(default_value:) do |provider|
87
+ provider.resolve_structure_value(flag_key:, default_value:)
72
88
  end
73
89
  end
74
90
 
@@ -82,8 +98,8 @@ module OpenFeature
82
98
  .returns(ResolutionDetails[String])
83
99
  end
84
100
  def resolve_string_value(flag_key:, default_value:, context: nil)
85
- resolve_from_sources(default_value: default_value) do |provider|
86
- provider.resolve_string_value(flag_key: flag_key, default_value: default_value, context: context)
101
+ resolve_from_sources(default_value:) do |provider|
102
+ provider.resolve_string_value(flag_key:, default_value:)
87
103
  end
88
104
  end
89
105
 
@@ -5,11 +5,9 @@ module OpenFeature
5
5
  # Default provider when initializing OpenFeature.
6
6
  # Always returns the default value given.
7
7
  # This will result in a TypeError if the given default value does not have the correct type.
8
- class NoOpProvider
8
+ class NoOpProvider < Provider
9
9
  extend T::Sig
10
10
 
11
- include Provider
12
-
13
11
  sig { override.returns(ProviderMetadata) }
14
12
  attr_reader :metadata
15
13
 
@@ -20,6 +18,7 @@ module OpenFeature
20
18
  def initialize
21
19
  @metadata = T.let(ProviderMetadata.new(name: "No Op Provider"), ProviderMetadata)
22
20
  @hooks = T.let([], T::Array[Hook])
21
+ super()
23
22
  end
24
23
 
25
24
  sig do
@@ -3,10 +3,21 @@
3
3
 
4
4
  module OpenFeature
5
5
  # Interface that providers must implement.
6
- module Provider
6
+ class Provider
7
7
  extend T::Sig
8
8
  extend T::Helpers
9
- interface!
9
+ abstract!
10
+
11
+ sig { returns(ProviderStatus) }
12
+ attr_reader :status
13
+
14
+ sig { params(status: ProviderStatus).void }
15
+ def initialize(status = ProviderStatus::Ready)
16
+ @status = status
17
+ end
18
+
19
+ sig { overridable.params(context: EvaluationContext).void }
20
+ def init(context:); end
10
21
 
11
22
  sig { abstract.returns(ProviderMetadata) }
12
23
  def metadata; end
@@ -14,6 +25,9 @@ module OpenFeature
14
25
  sig { abstract.returns(T::Array[Hook]) }
15
26
  def hooks; end
16
27
 
28
+ sig { overridable.void }
29
+ def shutdown; end
30
+
17
31
  sig do
18
32
  abstract
19
33
  .params(
@@ -0,0 +1,13 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module OpenFeature
5
+ # Indicates what state a provider is in
6
+ class ProviderStatus < T::Enum
7
+ enums do
8
+ NotReady = new
9
+ Ready = new
10
+ Error = new
11
+ end
12
+ end
13
+ end
data/lib/open_feature.rb CHANGED
@@ -19,6 +19,8 @@ module OpenFeature
19
19
 
20
20
  sig { params(provider: Provider).void }
21
21
  def set_provider(provider) # rubocop:disable Naming/AccessorMethodName
22
+ configuration.provider.shutdown
23
+ provider.init(context: configuration.evaluation_context || EvaluationContext.new)
22
24
  configuration.provider = provider
23
25
  end
24
26
 
@@ -42,12 +44,17 @@ module OpenFeature
42
44
  def create_client(name: nil, evaluation_context: nil, hooks: nil)
43
45
  Client.new(
44
46
  provider: configuration.provider,
45
- name: name,
46
- evaluation_context: evaluation_context,
47
+ name:,
48
+ evaluation_context:,
47
49
  hooks: Array(hooks)
48
50
  )
49
51
  end
50
52
 
53
+ sig { void }
54
+ def shutdown
55
+ configuration.provider.shutdown
56
+ end
57
+
51
58
  sig { returns(Configuration) }
52
59
  def configuration
53
60
  Configuration.instance
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-generated=true
@@ -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.
@@ -13,7 +13,7 @@ class Class < ::Module
13
13
  #
14
14
  # @return [Boolean]
15
15
  #
16
- # source://json//json/common.rb#700
16
+ # source://json//json/common.rb#694
17
17
  def json_creatable?; end
18
18
  end
19
19
 
@@ -300,6 +300,15 @@ end
300
300
  # # Raises JSON::NestingError (nesting of 2 is too deep):
301
301
  # JSON.generate(obj, max_nesting: 2)
302
302
  #
303
+ # ====== Escaping Options
304
+ #
305
+ # Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt>
306
+ # and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script
307
+ # tags.
308
+ #
309
+ # Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range
310
+ # should be escaped.
311
+ #
303
312
  # ====== Output Options
304
313
  #
305
314
  # The default formatting options generate the most compact
@@ -617,8 +626,8 @@ module JSON
617
626
  # Output:
618
627
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
619
628
  #
620
- # source://json//json/common.rb#631
621
- def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil)); end
629
+ # source://json//json/common.rb#614
630
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
622
631
 
623
632
  # :call-seq:
624
633
  # JSON.fast_generate(obj, opts) -> new_string
@@ -634,13 +643,13 @@ module JSON
634
643
  # # Raises SystemStackError (stack level too deep):
635
644
  # JSON.fast_generate(a)
636
645
  #
637
- # source://json//json/common.rb#335
646
+ # source://json//json/common.rb#328
638
647
  def fast_generate(obj, opts = T.unsafe(nil)); end
639
648
 
640
649
  # :stopdoc:
641
650
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
642
651
  #
643
- # source://json//json/common.rb#335
652
+ # source://json//json/common.rb#328
644
653
  def fast_unparse(obj, opts = T.unsafe(nil)); end
645
654
 
646
655
  # :call-seq:
@@ -679,7 +688,7 @@ module JSON
679
688
  # # Raises JSON::NestingError (nesting of 100 is too deep):
680
689
  # JSON.generate(a)
681
690
  #
682
- # source://json//json/common.rb#296
691
+ # source://json//json/common.rb#299
683
692
  def generate(obj, opts = T.unsafe(nil)); end
684
693
 
685
694
  # :call-seq:
@@ -810,7 +819,7 @@ module JSON
810
819
  # #<Admin:0x00000000064c41f8
811
820
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
812
821
  #
813
- # source://json//json/common.rb#557
822
+ # source://json//json/common.rb#540
814
823
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
815
824
 
816
825
  # :call-seq:
@@ -821,7 +830,7 @@ module JSON
821
830
  #
822
831
  # See method #parse.
823
832
  #
824
- # source://json//json/common.rb#245
833
+ # source://json//json/common.rb#248
825
834
  def load_file(filespec, opts = T.unsafe(nil)); end
826
835
 
827
836
  # :call-seq:
@@ -832,9 +841,12 @@ module JSON
832
841
  #
833
842
  # See method #parse!
834
843
  #
835
- # source://json//json/common.rb#256
844
+ # source://json//json/common.rb#259
836
845
  def load_file!(filespec, opts = T.unsafe(nil)); end
837
846
 
847
+ # source://json//json/common.rb#642
848
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
849
+
838
850
  # :call-seq:
839
851
  # JSON.parse(source, opts) -> object
840
852
  #
@@ -883,7 +895,7 @@ module JSON
883
895
  # # Raises JSON::ParserError (783: unexpected token at ''):
884
896
  # JSON.parse('')
885
897
  #
886
- # source://json//json/common.rb#215
898
+ # source://json//json/common.rb#218
887
899
  def parse(source, opts = T.unsafe(nil)); end
888
900
 
889
901
  # :call-seq:
@@ -898,7 +910,7 @@ module JSON
898
910
  # which disables checking for nesting depth.
899
911
  # - Option +allow_nan+, if not provided, defaults to +true+.
900
912
  #
901
- # source://json//json/common.rb#230
913
+ # source://json//json/common.rb#233
902
914
  def parse!(source, opts = T.unsafe(nil)); end
903
915
 
904
916
  # :call-seq:
@@ -931,28 +943,28 @@ module JSON
931
943
  # }
932
944
  # }
933
945
  #
934
- # source://json//json/common.rb#390
946
+ # source://json//json/common.rb#373
935
947
  def pretty_generate(obj, opts = T.unsafe(nil)); end
936
948
 
937
949
  # :stopdoc:
938
950
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
939
951
  #
940
- # source://json//json/common.rb#390
952
+ # source://json//json/common.rb#373
941
953
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
942
954
 
943
955
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
944
956
  #
945
- # source://json//json/common.rb#575
957
+ # source://json//json/common.rb#558
946
958
  def recurse_proc(result, &proc); end
947
959
 
948
- # source://json//json/common.rb#557
960
+ # source://json//json/common.rb#540
949
961
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
950
962
 
951
963
  # :stopdoc:
952
964
  # I want to deprecate these later, so I'll first be silent about them, and
953
965
  # later delete them.
954
966
  #
955
- # source://json//json/common.rb#296
967
+ # source://json//json/common.rb#299
956
968
  def unparse(obj, opts = T.unsafe(nil)); end
957
969
 
958
970
  class << self
@@ -968,26 +980,26 @@ module JSON
968
980
  # ruby = [0, 1, nil]
969
981
  # JSON[ruby] # => '[0,1,null]'
970
982
  #
971
- # source://json//json/common.rb#18
983
+ # source://json//json/common.rb#21
972
984
  def [](object, opts = T.unsafe(nil)); end
973
985
 
974
- # source://json//json/common.rb#81
986
+ # source://json//json/common.rb#84
975
987
  def create_fast_state; end
976
988
 
977
989
  # Returns the current create identifier.
978
990
  # See also JSON.create_id=.
979
991
  #
980
- # source://json//json/common.rb#126
992
+ # source://json//json/common.rb#129
981
993
  def create_id; end
982
994
 
983
995
  # Sets create identifier, which is used to decide if the _json_create_
984
996
  # hook of a class should be called; initial value is +json_class+:
985
997
  # JSON.create_id # => 'json_class'
986
998
  #
987
- # source://json//json/common.rb#120
999
+ # source://json//json/common.rb#123
988
1000
  def create_id=(new_value); end
989
1001
 
990
- # source://json//json/common.rb#91
1002
+ # source://json//json/common.rb#94
991
1003
  def create_pretty_state; end
992
1004
 
993
1005
  # Return the constant located at _path_. The format of _path_ has to be
@@ -995,7 +1007,7 @@ module JSON
995
1007
  # level (absolute namespace path?). If there doesn't exist a constant at
996
1008
  # the given path, an ArgumentError is raised.
997
1009
  #
998
- # source://json//json/common.rb#42
1010
+ # source://json//json/common.rb#45
999
1011
  def deep_const_get(path); end
1000
1012
 
1001
1013
  # :call-seq:
@@ -1026,23 +1038,23 @@ module JSON
1026
1038
  # Output:
1027
1039
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1028
1040
  #
1029
- # source://json//json/common.rb#631
1030
- def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil)); end
1041
+ # source://json//json/common.rb#614
1042
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1031
1043
 
1032
1044
  # Sets or returns the default options for the JSON.dump method.
1033
1045
  # Initially:
1034
1046
  # opts = JSON.dump_default_options
1035
- # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1047
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1036
1048
  #
1037
- # source://json//json/common.rb#596
1049
+ # source://json//json/common.rb#579
1038
1050
  def dump_default_options; end
1039
1051
 
1040
1052
  # Sets or returns the default options for the JSON.dump method.
1041
1053
  # Initially:
1042
1054
  # opts = JSON.dump_default_options
1043
- # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1055
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1044
1056
  #
1045
- # source://json//json/common.rb#596
1057
+ # source://json//json/common.rb#579
1046
1058
  def dump_default_options=(_arg0); end
1047
1059
 
1048
1060
  # :call-seq:
@@ -1059,13 +1071,13 @@ module JSON
1059
1071
  # # Raises SystemStackError (stack level too deep):
1060
1072
  # JSON.fast_generate(a)
1061
1073
  #
1062
- # source://json//json/common.rb#335
1074
+ # source://json//json/common.rb#328
1063
1075
  def fast_generate(obj, opts = T.unsafe(nil)); end
1064
1076
 
1065
1077
  # :stopdoc:
1066
1078
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1067
1079
  #
1068
- # source://json//json/common.rb#335
1080
+ # source://json//json/common.rb#328
1069
1081
  def fast_unparse(obj, opts = T.unsafe(nil)); end
1070
1082
 
1071
1083
  # :call-seq:
@@ -1104,24 +1116,24 @@ module JSON
1104
1116
  # # Raises JSON::NestingError (nesting of 100 is too deep):
1105
1117
  # JSON.generate(a)
1106
1118
  #
1107
- # source://json//json/common.rb#296
1119
+ # source://json//json/common.rb#299
1108
1120
  def generate(obj, opts = T.unsafe(nil)); end
1109
1121
 
1110
1122
  # Returns the JSON generator module that is used by JSON. This is
1111
1123
  # either JSON::Ext::Generator or JSON::Pure::Generator:
1112
1124
  # JSON.generator # => JSON::Ext::Generator
1113
1125
  #
1114
- # source://json//json/common.rb#103
1126
+ # source://json//json/common.rb#106
1115
1127
  def generator; end
1116
1128
 
1117
1129
  # Set the module _generator_ to be used by JSON.
1118
1130
  #
1119
- # source://json//json/common.rb#58
1131
+ # source://json//json/common.rb#61
1120
1132
  def generator=(generator); end
1121
1133
 
1122
1134
  # Encodes string using String.encode.
1123
1135
  #
1124
- # source://json//json/common.rb#653
1136
+ # source://json//json/common.rb#638
1125
1137
  def iconv(to, from, string); end
1126
1138
 
1127
1139
  # :call-seq:
@@ -1252,7 +1264,7 @@ module JSON
1252
1264
  # #<Admin:0x00000000064c41f8
1253
1265
  # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1254
1266
  #
1255
- # source://json//json/common.rb#557
1267
+ # source://json//json/common.rb#540
1256
1268
  def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1257
1269
 
1258
1270
  # Sets or returns default options for the JSON.load method.
@@ -1260,7 +1272,7 @@ module JSON
1260
1272
  # opts = JSON.load_default_options
1261
1273
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1262
1274
  #
1263
- # source://json//json/common.rb#420
1275
+ # source://json//json/common.rb#403
1264
1276
  def load_default_options; end
1265
1277
 
1266
1278
  # Sets or returns default options for the JSON.load method.
@@ -1268,7 +1280,7 @@ module JSON
1268
1280
  # opts = JSON.load_default_options
1269
1281
  # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1270
1282
  #
1271
- # source://json//json/common.rb#420
1283
+ # source://json//json/common.rb#403
1272
1284
  def load_default_options=(_arg0); end
1273
1285
 
1274
1286
  # :call-seq:
@@ -1279,7 +1291,7 @@ module JSON
1279
1291
  #
1280
1292
  # See method #parse.
1281
1293
  #
1282
- # source://json//json/common.rb#245
1294
+ # source://json//json/common.rb#248
1283
1295
  def load_file(filespec, opts = T.unsafe(nil)); end
1284
1296
 
1285
1297
  # :call-seq:
@@ -1290,7 +1302,7 @@ module JSON
1290
1302
  #
1291
1303
  # See method #parse!
1292
1304
  #
1293
- # source://json//json/common.rb#256
1305
+ # source://json//json/common.rb#259
1294
1306
  def load_file!(filespec, opts = T.unsafe(nil)); end
1295
1307
 
1296
1308
  # :call-seq:
@@ -1341,7 +1353,7 @@ module JSON
1341
1353
  # # Raises JSON::ParserError (783: unexpected token at ''):
1342
1354
  # JSON.parse('')
1343
1355
  #
1344
- # source://json//json/common.rb#215
1356
+ # source://json//json/common.rb#218
1345
1357
  def parse(source, opts = T.unsafe(nil)); end
1346
1358
 
1347
1359
  # :call-seq:
@@ -1356,19 +1368,19 @@ module JSON
1356
1368
  # which disables checking for nesting depth.
1357
1369
  # - Option +allow_nan+, if not provided, defaults to +true+.
1358
1370
  #
1359
- # source://json//json/common.rb#230
1371
+ # source://json//json/common.rb#233
1360
1372
  def parse!(source, opts = T.unsafe(nil)); end
1361
1373
 
1362
1374
  # Returns the JSON parser class that is used by JSON. This is either
1363
1375
  # JSON::Ext::Parser or JSON::Pure::Parser:
1364
1376
  # JSON.parser # => JSON::Ext::Parser
1365
1377
  #
1366
- # source://json//json/common.rb#29
1378
+ # source://json//json/common.rb#32
1367
1379
  def parser; end
1368
1380
 
1369
1381
  # Set the JSON parser class _parser_ to be used by JSON.
1370
1382
  #
1371
- # source://json//json/common.rb#32
1383
+ # source://json//json/common.rb#35
1372
1384
  def parser=(parser); end
1373
1385
 
1374
1386
  # :call-seq:
@@ -1401,50 +1413,55 @@ module JSON
1401
1413
  # }
1402
1414
  # }
1403
1415
  #
1404
- # source://json//json/common.rb#390
1416
+ # source://json//json/common.rb#373
1405
1417
  def pretty_generate(obj, opts = T.unsafe(nil)); end
1406
1418
 
1407
1419
  # :stopdoc:
1408
1420
  # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1409
1421
  #
1410
- # source://json//json/common.rb#390
1422
+ # source://json//json/common.rb#373
1411
1423
  def pretty_unparse(obj, opts = T.unsafe(nil)); end
1412
1424
 
1413
1425
  # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1414
1426
  #
1415
- # source://json//json/common.rb#575
1427
+ # source://json//json/common.rb#558
1416
1428
  def recurse_proc(result, &proc); end
1417
1429
 
1418
- # source://json//json/common.rb#557
1430
+ # source://json//json/common.rb#540
1419
1431
  def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1420
1432
 
1421
1433
  # Sets or Returns the JSON generator state class that is used by JSON. This is
1422
1434
  # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1423
1435
  # JSON.state # => JSON::Ext::Generator::State
1424
1436
  #
1425
- # source://json//json/common.rb#108
1437
+ # source://json//json/common.rb#111
1426
1438
  def state; end
1427
1439
 
1428
1440
  # Sets or Returns the JSON generator state class that is used by JSON. This is
1429
1441
  # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1430
1442
  # JSON.state # => JSON::Ext::Generator::State
1431
1443
  #
1432
- # source://json//json/common.rb#108
1444
+ # source://json//json/common.rb#111
1433
1445
  def state=(_arg0); end
1434
1446
 
1435
1447
  # :stopdoc:
1436
1448
  # I want to deprecate these later, so I'll first be silent about them, and
1437
1449
  # later delete them.
1438
1450
  #
1439
- # source://json//json/common.rb#296
1451
+ # source://json//json/common.rb#299
1440
1452
  def unparse(obj, opts = T.unsafe(nil)); end
1453
+
1454
+ private
1455
+
1456
+ # source://json//json/common.rb#642
1457
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
1441
1458
  end
1442
1459
  end
1443
1460
 
1444
- # source://json//json/common.rb#114
1461
+ # source://json//json/common.rb#117
1445
1462
  JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1446
1463
 
1447
- # source://json//json/common.rb#111
1464
+ # source://json//json/common.rb#114
1448
1465
  JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1449
1466
 
1450
1467
  class JSON::GenericObject < ::OpenStruct
@@ -1490,20 +1507,23 @@ end
1490
1507
  # The base exception for JSON errors.
1491
1508
  class JSON::JSONError < ::StandardError
1492
1509
  class << self
1493
- # source://json//json/common.rb#138
1510
+ # source://json//json/common.rb#141
1494
1511
  def wrap(exception); end
1495
1512
  end
1496
1513
  end
1497
1514
 
1498
- # source://json//json/common.rb#35
1515
+ # source://json//json/common.rb#6
1516
+ JSON::NOT_SET = T.let(T.unsafe(nil), Object)
1517
+
1518
+ # source://json//json/common.rb#38
1499
1519
  JSON::Parser = JSON::Ext::Parser
1500
1520
 
1501
- # source://json//json/common.rb#73
1521
+ # source://json//json/common.rb#76
1502
1522
  JSON::State = JSON::Ext::Generator::State
1503
1523
 
1504
1524
  # For backwards compatibility
1505
1525
  #
1506
- # source://json//json/common.rb#159
1526
+ # source://json//json/common.rb#162
1507
1527
  JSON::UnparserError = JSON::GeneratorError
1508
1528
 
1509
1529
  module Kernel
@@ -1516,18 +1536,18 @@ module Kernel
1516
1536
  # The _opts_ argument is passed through to generate/parse respectively. See
1517
1537
  # generate and parse for their documentation.
1518
1538
  #
1519
- # source://json//json/common.rb#685
1539
+ # source://json//json/common.rb#679
1520
1540
  def JSON(object, *args); end
1521
1541
 
1522
1542
  # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1523
1543
  # one line.
1524
1544
  #
1525
- # source://json//json/common.rb#663
1545
+ # source://json//json/common.rb#657
1526
1546
  def j(*objs); end
1527
1547
 
1528
1548
  # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1529
1549
  # indentation and over many lines.
1530
1550
  #
1531
- # source://json//json/common.rb#672
1551
+ # source://json//json/common.rb#666
1532
1552
  def jj(*objs); end
1533
1553
  end