privat_bank_business_api 0.2.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 (102) hide show
  1. checksums.yaml +7 -0
  2. data/.devcontainer/Dockerfile +17 -0
  3. data/.devcontainer/devcontainer.json +33 -0
  4. data/.devcontainer/post-create.sh +8 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +9 -0
  7. data/.vscode/settings.json +6 -0
  8. data/CHANGELOG.md +12 -0
  9. data/CODE_OF_CONDUCT.md +132 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +123 -0
  12. data/Rakefile +12 -0
  13. data/lib/pb_api/base_transformer.rb +19 -0
  14. data/lib/pb_api/client.rb +41 -0
  15. data/lib/pb_api/models/balance.rb +79 -0
  16. data/lib/pb_api/models/base_struct.rb +30 -0
  17. data/lib/pb_api/models/transaction.rb +114 -0
  18. data/lib/pb_api/pagination_helper.rb +73 -0
  19. data/lib/pb_api/resource.rb +97 -0
  20. data/lib/pb_api/resources/balance_resource.rb +40 -0
  21. data/lib/pb_api/resources/transaction_resource.rb +105 -0
  22. data/lib/pb_api/transformers/balance_transformer.rb +35 -0
  23. data/lib/pb_api/transformers/transaction_transformer.rb +46 -0
  24. data/lib/pb_api/types.rb +8 -0
  25. data/lib/pb_api/version.rb +5 -0
  26. data/lib/pb_api.rb +34 -0
  27. data/sig/privat_bank_buisness_api.rbs +4 -0
  28. data/sorbet/config +4 -0
  29. data/sorbet/rbi/annotations/.gitattributes +1 -0
  30. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  31. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  32. data/sorbet/rbi/gems/.gitattributes +1 -0
  33. data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
  34. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  35. data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +9 -0
  36. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +9 -0
  37. data/sorbet/rbi/gems/date@3.4.1.rbi +75 -0
  38. data/sorbet/rbi/gems/diff-lcs@1.6.0.rbi +1134 -0
  39. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +9 -0
  40. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +9 -0
  41. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +9 -0
  42. data/sorbet/rbi/gems/dry-struct@1.7.1.rbi +925 -0
  43. data/sorbet/rbi/gems/dry-transformer@1.0.1.rbi +1512 -0
  44. data/sorbet/rbi/gems/dry-types@1.8.2.rbi +9 -0
  45. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  46. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +9 -0
  47. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +9 -0
  48. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +9 -0
  49. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +9 -0
  50. data/sorbet/rbi/gems/faraday-multipart@1.1.0.rbi +9 -0
  51. data/sorbet/rbi/gems/faraday-net_http@1.0.2.rbi +9 -0
  52. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +9 -0
  53. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +9 -0
  54. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +9 -0
  55. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +9 -0
  56. data/sorbet/rbi/gems/faraday@1.10.4.rbi +9 -0
  57. data/sorbet/rbi/gems/faraday_middleware@1.2.1.rbi +9 -0
  58. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2208 -0
  59. data/sorbet/rbi/gems/ice_nine@0.11.2.rbi +9 -0
  60. data/sorbet/rbi/gems/io-console@0.8.0.rbi +9 -0
  61. data/sorbet/rbi/gems/json@2.10.1.rbi +2120 -0
  62. data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
  63. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
  64. data/sorbet/rbi/gems/logger@1.6.6.rbi +940 -0
  65. data/sorbet/rbi/gems/money@6.19.0.rbi +2260 -0
  66. data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +9 -0
  67. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  68. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  69. data/sorbet/rbi/gems/parser@3.3.7.1.rbi +5525 -0
  70. data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
  71. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
  72. data/sorbet/rbi/gems/prism@1.3.0.rbi +41403 -0
  73. data/sorbet/rbi/gems/psych@5.2.3.rbi +2435 -0
  74. data/sorbet/rbi/gems/racc@1.8.1.rbi +164 -0
  75. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  76. data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
  77. data/sorbet/rbi/gems/rbi@0.2.4.rbi +4542 -0
  78. data/sorbet/rbi/gems/rdoc@6.12.0.rbi +12758 -0
  79. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3795 -0
  80. data/sorbet/rbi/gems/reline@0.6.0.rbi +2451 -0
  81. data/sorbet/rbi/gems/rspec-core@3.13.3.rbi +10986 -0
  82. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +8183 -0
  83. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +5341 -0
  84. data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +1630 -0
  85. data/sorbet/rbi/gems/rspec@3.13.0.rbi +83 -0
  86. data/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +7654 -0
  87. data/sorbet/rbi/gems/rubocop@1.72.2.rbi +61026 -0
  88. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  89. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
  90. data/sorbet/rbi/gems/spoom@1.5.4.rbi +5026 -0
  91. data/sorbet/rbi/gems/stringio@3.1.5.rbi +9 -0
  92. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3656 -0
  93. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  94. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  95. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  96. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  97. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  98. data/sorbet/rbi/gems/zeitwerk@2.7.2.rbi +9 -0
  99. data/sorbet/rbi/todo.rbi +17 -0
  100. data/sorbet/tapioca/config.yml +13 -0
  101. data/sorbet/tapioca/require.rb +8 -0
  102. metadata +231 -0
@@ -0,0 +1,2120 @@
1
+ # typed: false
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `json` gem.
5
+ # Please instead update this file by running `bin/tapioca gem json`.
6
+
7
+
8
+ class Array
9
+ include ::Enumerable
10
+ include ::JSON::Ext::Generator::GeneratorMethods::Array
11
+ end
12
+
13
+ # Extends any Class to include _json_creatable?_ method.
14
+ #
15
+ # source://json//lib/json/common.rb#985
16
+ class Class < ::Module
17
+ # Returns true if this class can be used to create an instance
18
+ # from a serialised JSON string. The class has to implement a class
19
+ # method _json_create_ that expects a hash as first parameter. The hash
20
+ # should include the required data.
21
+ #
22
+ # @return [Boolean]
23
+ #
24
+ # source://json//lib/json/common.rb#990
25
+ def json_creatable?; end
26
+ end
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
+
45
+ # = JavaScript \Object Notation (\JSON)
46
+ #
47
+ # \JSON is a lightweight data-interchange format.
48
+ #
49
+ # A \JSON value is one of the following:
50
+ # - Double-quoted text: <tt>"foo"</tt>.
51
+ # - Number: +1+, +1.0+, +2.0e2+.
52
+ # - Boolean: +true+, +false+.
53
+ # - Null: +null+.
54
+ # - \Array: an ordered list of values, enclosed by square brackets:
55
+ # ["foo", 1, 1.0, 2.0e2, true, false, null]
56
+ #
57
+ # - \Object: a collection of name/value pairs, enclosed by curly braces;
58
+ # each name is double-quoted text;
59
+ # the values may be any \JSON values:
60
+ # {"a": "foo", "b": 1, "c": 1.0, "d": 2.0e2, "e": true, "f": false, "g": null}
61
+ #
62
+ # A \JSON array or object may contain nested arrays, objects, and scalars
63
+ # to any depth:
64
+ # {"foo": {"bar": 1, "baz": 2}, "bat": [0, 1, 2]}
65
+ # [{"foo": 0, "bar": 1}, ["baz", 2]]
66
+ #
67
+ # == Using \Module \JSON
68
+ #
69
+ # To make module \JSON available in your code, begin with:
70
+ # require 'json'
71
+ #
72
+ # All examples here assume that this has been done.
73
+ #
74
+ # === Parsing \JSON
75
+ #
76
+ # You can parse a \String containing \JSON data using
77
+ # either of two methods:
78
+ # - <tt>JSON.parse(source, opts)</tt>
79
+ # - <tt>JSON.parse!(source, opts)</tt>
80
+ #
81
+ # where
82
+ # - +source+ is a Ruby object.
83
+ # - +opts+ is a \Hash object containing options
84
+ # that control both input allowed and output formatting.
85
+ #
86
+ # The difference between the two methods
87
+ # is that JSON.parse! omits some checks
88
+ # and may not be safe for some +source+ data;
89
+ # use it only for data from trusted sources.
90
+ # Use the safer method JSON.parse for less trusted sources.
91
+ #
92
+ # ==== Parsing \JSON Arrays
93
+ #
94
+ # When +source+ is a \JSON array, JSON.parse by default returns a Ruby \Array:
95
+ # json = '["foo", 1, 1.0, 2.0e2, true, false, null]'
96
+ # ruby = JSON.parse(json)
97
+ # ruby # => ["foo", 1, 1.0, 200.0, true, false, nil]
98
+ # ruby.class # => Array
99
+ #
100
+ # The \JSON array may contain nested arrays, objects, and scalars
101
+ # to any depth:
102
+ # json = '[{"foo": 0, "bar": 1}, ["baz", 2]]'
103
+ # JSON.parse(json) # => [{"foo"=>0, "bar"=>1}, ["baz", 2]]
104
+ #
105
+ # ==== Parsing \JSON \Objects
106
+ #
107
+ # When the source is a \JSON object, JSON.parse by default returns a Ruby \Hash:
108
+ # json = '{"a": "foo", "b": 1, "c": 1.0, "d": 2.0e2, "e": true, "f": false, "g": null}'
109
+ # ruby = JSON.parse(json)
110
+ # ruby # => {"a"=>"foo", "b"=>1, "c"=>1.0, "d"=>200.0, "e"=>true, "f"=>false, "g"=>nil}
111
+ # ruby.class # => Hash
112
+ #
113
+ # The \JSON object may contain nested arrays, objects, and scalars
114
+ # to any depth:
115
+ # json = '{"foo": {"bar": 1, "baz": 2}, "bat": [0, 1, 2]}'
116
+ # JSON.parse(json) # => {"foo"=>{"bar"=>1, "baz"=>2}, "bat"=>[0, 1, 2]}
117
+ #
118
+ # ==== Parsing \JSON Scalars
119
+ #
120
+ # When the source is a \JSON scalar (not an array or object),
121
+ # JSON.parse returns a Ruby scalar.
122
+ #
123
+ # \String:
124
+ # ruby = JSON.parse('"foo"')
125
+ # ruby # => 'foo'
126
+ # ruby.class # => String
127
+ # \Integer:
128
+ # ruby = JSON.parse('1')
129
+ # ruby # => 1
130
+ # ruby.class # => Integer
131
+ # \Float:
132
+ # ruby = JSON.parse('1.0')
133
+ # ruby # => 1.0
134
+ # ruby.class # => Float
135
+ # ruby = JSON.parse('2.0e2')
136
+ # ruby # => 200
137
+ # ruby.class # => Float
138
+ # Boolean:
139
+ # ruby = JSON.parse('true')
140
+ # ruby # => true
141
+ # ruby.class # => TrueClass
142
+ # ruby = JSON.parse('false')
143
+ # ruby # => false
144
+ # ruby.class # => FalseClass
145
+ # Null:
146
+ # ruby = JSON.parse('null')
147
+ # ruby # => nil
148
+ # ruby.class # => NilClass
149
+ #
150
+ # ==== Parsing Options
151
+ #
152
+ # ====== Input Options
153
+ #
154
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth allowed;
155
+ # defaults to +100+; specify +false+ to disable depth checking.
156
+ #
157
+ # With the default, +false+:
158
+ # source = '[0, [1, [2, [3]]]]'
159
+ # ruby = JSON.parse(source)
160
+ # ruby # => [0, [1, [2, [3]]]]
161
+ # Too deep:
162
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
163
+ # JSON.parse(source, {max_nesting: 1})
164
+ # Bad value:
165
+ # # Raises TypeError (wrong argument type Symbol (expected Fixnum)):
166
+ # JSON.parse(source, {max_nesting: :foo})
167
+ #
168
+ # ---
169
+ #
170
+ # Option +allow_nan+ (boolean) specifies whether to allow
171
+ # NaN, Infinity, and MinusInfinity in +source+;
172
+ # defaults to +false+.
173
+ #
174
+ # With the default, +false+:
175
+ # # Raises JSON::ParserError (225: unexpected token at '[NaN]'):
176
+ # JSON.parse('[NaN]')
177
+ # # Raises JSON::ParserError (232: unexpected token at '[Infinity]'):
178
+ # JSON.parse('[Infinity]')
179
+ # # Raises JSON::ParserError (248: unexpected token at '[-Infinity]'):
180
+ # JSON.parse('[-Infinity]')
181
+ # Allow:
182
+ # source = '[NaN, Infinity, -Infinity]'
183
+ # ruby = JSON.parse(source, {allow_nan: true})
184
+ # ruby # => [NaN, Infinity, -Infinity]
185
+ #
186
+ # ====== Output Options
187
+ #
188
+ # Option +symbolize_names+ (boolean) specifies whether returned \Hash keys
189
+ # should be Symbols;
190
+ # defaults to +false+ (use Strings).
191
+ #
192
+ # With the default, +false+:
193
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
194
+ # ruby = JSON.parse(source)
195
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
196
+ # Use Symbols:
197
+ # ruby = JSON.parse(source, {symbolize_names: true})
198
+ # ruby # => {:a=>"foo", :b=>1.0, :c=>true, :d=>false, :e=>nil}
199
+ #
200
+ # ---
201
+ #
202
+ # Option +object_class+ (\Class) specifies the Ruby class to be used
203
+ # for each \JSON object;
204
+ # defaults to \Hash.
205
+ #
206
+ # With the default, \Hash:
207
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
208
+ # ruby = JSON.parse(source)
209
+ # ruby.class # => Hash
210
+ # Use class \OpenStruct:
211
+ # ruby = JSON.parse(source, {object_class: OpenStruct})
212
+ # ruby # => #<OpenStruct a="foo", b=1.0, c=true, d=false, e=nil>
213
+ #
214
+ # ---
215
+ #
216
+ # Option +array_class+ (\Class) specifies the Ruby class to be used
217
+ # for each \JSON array;
218
+ # defaults to \Array.
219
+ #
220
+ # With the default, \Array:
221
+ # source = '["foo", 1.0, true, false, null]'
222
+ # ruby = JSON.parse(source)
223
+ # ruby.class # => Array
224
+ # Use class \Set:
225
+ # ruby = JSON.parse(source, {array_class: Set})
226
+ # ruby # => #<Set: {"foo", 1.0, true, false, nil}>
227
+ #
228
+ # ---
229
+ #
230
+ # Option +create_additions+ (boolean) specifies whether to use \JSON additions in parsing.
231
+ # See {\JSON Additions}[#module-JSON-label-JSON+Additions].
232
+ #
233
+ # === Generating \JSON
234
+ #
235
+ # To generate a Ruby \String containing \JSON data,
236
+ # use method <tt>JSON.generate(source, opts)</tt>, where
237
+ # - +source+ is a Ruby object.
238
+ # - +opts+ is a \Hash object containing options
239
+ # that control both input allowed and output formatting.
240
+ #
241
+ # ==== Generating \JSON from Arrays
242
+ #
243
+ # When the source is a Ruby \Array, JSON.generate returns
244
+ # a \String containing a \JSON array:
245
+ # ruby = [0, 's', :foo]
246
+ # json = JSON.generate(ruby)
247
+ # json # => '[0,"s","foo"]'
248
+ #
249
+ # The Ruby \Array array may contain nested arrays, hashes, and scalars
250
+ # to any depth:
251
+ # ruby = [0, [1, 2], {foo: 3, bar: 4}]
252
+ # json = JSON.generate(ruby)
253
+ # json # => '[0,[1,2],{"foo":3,"bar":4}]'
254
+ #
255
+ # ==== Generating \JSON from Hashes
256
+ #
257
+ # When the source is a Ruby \Hash, JSON.generate returns
258
+ # a \String containing a \JSON object:
259
+ # ruby = {foo: 0, bar: 's', baz: :bat}
260
+ # json = JSON.generate(ruby)
261
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
262
+ #
263
+ # The Ruby \Hash array may contain nested arrays, hashes, and scalars
264
+ # to any depth:
265
+ # ruby = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
266
+ # json = JSON.generate(ruby)
267
+ # json # => '{"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}'
268
+ #
269
+ # ==== Generating \JSON from Other Objects
270
+ #
271
+ # When the source is neither an \Array nor a \Hash,
272
+ # the generated \JSON data depends on the class of the source.
273
+ #
274
+ # When the source is a Ruby \Integer or \Float, JSON.generate returns
275
+ # a \String containing a \JSON number:
276
+ # JSON.generate(42) # => '42'
277
+ # JSON.generate(0.42) # => '0.42'
278
+ #
279
+ # When the source is a Ruby \String, JSON.generate returns
280
+ # a \String containing a \JSON string (with double-quotes):
281
+ # JSON.generate('A string') # => '"A string"'
282
+ #
283
+ # When the source is +true+, +false+ or +nil+, JSON.generate returns
284
+ # a \String containing the corresponding \JSON token:
285
+ # JSON.generate(true) # => 'true'
286
+ # JSON.generate(false) # => 'false'
287
+ # JSON.generate(nil) # => 'null'
288
+ #
289
+ # When the source is none of the above, JSON.generate returns
290
+ # a \String containing a \JSON string representation of the source:
291
+ # JSON.generate(:foo) # => '"foo"'
292
+ # JSON.generate(Complex(0, 0)) # => '"0+0i"'
293
+ # JSON.generate(Dir.new('.')) # => '"#<Dir>"'
294
+ #
295
+ # ==== Generating Options
296
+ #
297
+ # ====== Input Options
298
+ #
299
+ # Option +allow_nan+ (boolean) specifies whether
300
+ # +NaN+, +Infinity+, and <tt>-Infinity</tt> may be generated;
301
+ # defaults to +false+.
302
+ #
303
+ # With the default, +false+:
304
+ # # Raises JSON::GeneratorError (920: NaN not allowed in JSON):
305
+ # JSON.generate(JSON::NaN)
306
+ # # Raises JSON::GeneratorError (917: Infinity not allowed in JSON):
307
+ # JSON.generate(JSON::Infinity)
308
+ # # Raises JSON::GeneratorError (917: -Infinity not allowed in JSON):
309
+ # JSON.generate(JSON::MinusInfinity)
310
+ #
311
+ # Allow:
312
+ # ruby = [Float::NaN, Float::Infinity, Float::MinusInfinity]
313
+ # JSON.generate(ruby, allow_nan: true) # => '[NaN,Infinity,-Infinity]'
314
+ #
315
+ # ---
316
+ #
317
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth
318
+ # in +obj+; defaults to +100+.
319
+ #
320
+ # With the default, +100+:
321
+ # obj = [[[[[[0]]]]]]
322
+ # JSON.generate(obj) # => '[[[[[[0]]]]]]'
323
+ #
324
+ # Too deep:
325
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
326
+ # JSON.generate(obj, max_nesting: 2)
327
+ #
328
+ # ====== Escaping Options
329
+ #
330
+ # Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt>
331
+ # and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script
332
+ # tags.
333
+ #
334
+ # Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range
335
+ # should be escaped.
336
+ #
337
+ # ====== Output Options
338
+ #
339
+ # The default formatting options generate the most compact
340
+ # \JSON data, all on one line and with no whitespace.
341
+ #
342
+ # You can use these formatting options to generate
343
+ # \JSON data in a more open format, using whitespace.
344
+ # See also JSON.pretty_generate.
345
+ #
346
+ # - Option +array_nl+ (\String) specifies a string (usually a newline)
347
+ # to be inserted after each \JSON array; defaults to the empty \String, <tt>''</tt>.
348
+ # - Option +object_nl+ (\String) specifies a string (usually a newline)
349
+ # to be inserted after each \JSON object; defaults to the empty \String, <tt>''</tt>.
350
+ # - Option +indent+ (\String) specifies the string (usually spaces) to be
351
+ # used for indentation; defaults to the empty \String, <tt>''</tt>;
352
+ # defaults to the empty \String, <tt>''</tt>;
353
+ # has no effect unless options +array_nl+ or +object_nl+ specify newlines.
354
+ # - Option +space+ (\String) specifies a string (usually a space) to be
355
+ # inserted after the colon in each \JSON object's pair;
356
+ # defaults to the empty \String, <tt>''</tt>.
357
+ # - Option +space_before+ (\String) specifies a string (usually a space) to be
358
+ # inserted before the colon in each \JSON object's pair;
359
+ # defaults to the empty \String, <tt>''</tt>.
360
+ #
361
+ # In this example, +obj+ is used first to generate the shortest
362
+ # \JSON data (no whitespace), then again with all formatting options
363
+ # specified:
364
+ #
365
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
366
+ # json = JSON.generate(obj)
367
+ # puts 'Compact:', json
368
+ # opts = {
369
+ # array_nl: "\n",
370
+ # object_nl: "\n",
371
+ # indent: ' ',
372
+ # space_before: ' ',
373
+ # space: ' '
374
+ # }
375
+ # puts 'Open:', JSON.generate(obj, opts)
376
+ #
377
+ # Output:
378
+ # Compact:
379
+ # {"foo":["bar","baz"],"bat":{"bam":0,"bad":1}}
380
+ # Open:
381
+ # {
382
+ # "foo" : [
383
+ # "bar",
384
+ # "baz"
385
+ # ],
386
+ # "bat" : {
387
+ # "bam" : 0,
388
+ # "bad" : 1
389
+ # }
390
+ # }
391
+ #
392
+ # == \JSON Additions
393
+ #
394
+ # When you "round trip" a non-\String object from Ruby to \JSON and back,
395
+ # you have a new \String, instead of the object you began with:
396
+ # ruby0 = Range.new(0, 2)
397
+ # json = JSON.generate(ruby0)
398
+ # json # => '0..2"'
399
+ # ruby1 = JSON.parse(json)
400
+ # ruby1 # => '0..2'
401
+ # ruby1.class # => String
402
+ #
403
+ # You can use \JSON _additions_ to preserve the original object.
404
+ # The addition is an extension of a ruby class, so that:
405
+ # - \JSON.generate stores more information in the \JSON string.
406
+ # - \JSON.parse, called with option +create_additions+,
407
+ # uses that information to create a proper Ruby object.
408
+ #
409
+ # This example shows a \Range being generated into \JSON
410
+ # and parsed back into Ruby, both without and with
411
+ # the addition for \Range:
412
+ # ruby = Range.new(0, 2)
413
+ # # This passage does not use the addition for Range.
414
+ # json0 = JSON.generate(ruby)
415
+ # ruby0 = JSON.parse(json0)
416
+ # # This passage uses the addition for Range.
417
+ # require 'json/add/range'
418
+ # json1 = JSON.generate(ruby)
419
+ # ruby1 = JSON.parse(json1, create_additions: true)
420
+ # # Make a nice display.
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})
428
+ # EOT
429
+ # puts display
430
+ #
431
+ # This output shows the different results:
432
+ # Generated JSON:
433
+ # Without addition: "0..2" (String)
434
+ # With addition: {"json_class":"Range","a":[0,2,false]} (String)
435
+ # Parsed JSON:
436
+ # Without addition: "0..2" (String)
437
+ # With addition: 0..2 (Range)
438
+ #
439
+ # The \JSON module includes additions for certain classes.
440
+ # You can also craft custom additions.
441
+ # See {Custom \JSON Additions}[#module-JSON-label-Custom+JSON+Additions].
442
+ #
443
+ # === Built-in Additions
444
+ #
445
+ # The \JSON module includes additions for certain classes.
446
+ # To use an addition, +require+ its source:
447
+ # - BigDecimal: <tt>require 'json/add/bigdecimal'</tt>
448
+ # - Complex: <tt>require 'json/add/complex'</tt>
449
+ # - Date: <tt>require 'json/add/date'</tt>
450
+ # - DateTime: <tt>require 'json/add/date_time'</tt>
451
+ # - Exception: <tt>require 'json/add/exception'</tt>
452
+ # - OpenStruct: <tt>require 'json/add/ostruct'</tt>
453
+ # - Range: <tt>require 'json/add/range'</tt>
454
+ # - Rational: <tt>require 'json/add/rational'</tt>
455
+ # - Regexp: <tt>require 'json/add/regexp'</tt>
456
+ # - Set: <tt>require 'json/add/set'</tt>
457
+ # - Struct: <tt>require 'json/add/struct'</tt>
458
+ # - Symbol: <tt>require 'json/add/symbol'</tt>
459
+ # - Time: <tt>require 'json/add/time'</tt>
460
+ #
461
+ # To reduce punctuation clutter, the examples below
462
+ # show the generated \JSON via +puts+, rather than the usual +inspect+,
463
+ #
464
+ # \BigDecimal:
465
+ # require 'json/add/bigdecimal'
466
+ # ruby0 = BigDecimal(0) # 0.0
467
+ # json = JSON.generate(ruby0) # {"json_class":"BigDecimal","b":"27:0.0"}
468
+ # ruby1 = JSON.parse(json, create_additions: true) # 0.0
469
+ # ruby1.class # => BigDecimal
470
+ #
471
+ # \Complex:
472
+ # require 'json/add/complex'
473
+ # ruby0 = Complex(1+0i) # 1+0i
474
+ # json = JSON.generate(ruby0) # {"json_class":"Complex","r":1,"i":0}
475
+ # ruby1 = JSON.parse(json, create_additions: true) # 1+0i
476
+ # ruby1.class # Complex
477
+ #
478
+ # \Date:
479
+ # require 'json/add/date'
480
+ # ruby0 = Date.today # 2020-05-02
481
+ # json = JSON.generate(ruby0) # {"json_class":"Date","y":2020,"m":5,"d":2,"sg":2299161.0}
482
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02
483
+ # ruby1.class # Date
484
+ #
485
+ # \DateTime:
486
+ # require 'json/add/date_time'
487
+ # ruby0 = DateTime.now # 2020-05-02T10:38:13-05:00
488
+ # json = JSON.generate(ruby0) # {"json_class":"DateTime","y":2020,"m":5,"d":2,"H":10,"M":38,"S":13,"of":"-5/24","sg":2299161.0}
489
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02T10:38:13-05:00
490
+ # ruby1.class # DateTime
491
+ #
492
+ # \Exception (and its subclasses including \RuntimeError):
493
+ # require 'json/add/exception'
494
+ # ruby0 = Exception.new('A message') # A message
495
+ # json = JSON.generate(ruby0) # {"json_class":"Exception","m":"A message","b":null}
496
+ # ruby1 = JSON.parse(json, create_additions: true) # A message
497
+ # ruby1.class # Exception
498
+ # ruby0 = RuntimeError.new('Another message') # Another message
499
+ # json = JSON.generate(ruby0) # {"json_class":"RuntimeError","m":"Another message","b":null}
500
+ # ruby1 = JSON.parse(json, create_additions: true) # Another message
501
+ # ruby1.class # RuntimeError
502
+ #
503
+ # \OpenStruct:
504
+ # require 'json/add/ostruct'
505
+ # ruby0 = OpenStruct.new(name: 'Matz', language: 'Ruby') # #<OpenStruct name="Matz", language="Ruby">
506
+ # json = JSON.generate(ruby0) # {"json_class":"OpenStruct","t":{"name":"Matz","language":"Ruby"}}
507
+ # ruby1 = JSON.parse(json, create_additions: true) # #<OpenStruct name="Matz", language="Ruby">
508
+ # ruby1.class # OpenStruct
509
+ #
510
+ # \Range:
511
+ # require 'json/add/range'
512
+ # ruby0 = Range.new(0, 2) # 0..2
513
+ # json = JSON.generate(ruby0) # {"json_class":"Range","a":[0,2,false]}
514
+ # ruby1 = JSON.parse(json, create_additions: true) # 0..2
515
+ # ruby1.class # Range
516
+ #
517
+ # \Rational:
518
+ # require 'json/add/rational'
519
+ # ruby0 = Rational(1, 3) # 1/3
520
+ # json = JSON.generate(ruby0) # {"json_class":"Rational","n":1,"d":3}
521
+ # ruby1 = JSON.parse(json, create_additions: true) # 1/3
522
+ # ruby1.class # Rational
523
+ #
524
+ # \Regexp:
525
+ # require 'json/add/regexp'
526
+ # ruby0 = Regexp.new('foo') # (?-mix:foo)
527
+ # json = JSON.generate(ruby0) # {"json_class":"Regexp","o":0,"s":"foo"}
528
+ # ruby1 = JSON.parse(json, create_additions: true) # (?-mix:foo)
529
+ # ruby1.class # Regexp
530
+ #
531
+ # \Set:
532
+ # require 'json/add/set'
533
+ # ruby0 = Set.new([0, 1, 2]) # #<Set: {0, 1, 2}>
534
+ # json = JSON.generate(ruby0) # {"json_class":"Set","a":[0,1,2]}
535
+ # ruby1 = JSON.parse(json, create_additions: true) # #<Set: {0, 1, 2}>
536
+ # ruby1.class # Set
537
+ #
538
+ # \Struct:
539
+ # require 'json/add/struct'
540
+ # Customer = Struct.new(:name, :address) # Customer
541
+ # ruby0 = Customer.new("Dave", "123 Main") # #<struct Customer name="Dave", address="123 Main">
542
+ # json = JSON.generate(ruby0) # {"json_class":"Customer","v":["Dave","123 Main"]}
543
+ # ruby1 = JSON.parse(json, create_additions: true) # #<struct Customer name="Dave", address="123 Main">
544
+ # ruby1.class # Customer
545
+ #
546
+ # \Symbol:
547
+ # require 'json/add/symbol'
548
+ # ruby0 = :foo # foo
549
+ # json = JSON.generate(ruby0) # {"json_class":"Symbol","s":"foo"}
550
+ # ruby1 = JSON.parse(json, create_additions: true) # foo
551
+ # ruby1.class # Symbol
552
+ #
553
+ # \Time:
554
+ # require 'json/add/time'
555
+ # ruby0 = Time.now # 2020-05-02 11:28:26 -0500
556
+ # json = JSON.generate(ruby0) # {"json_class":"Time","s":1588436906,"n":840560000}
557
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02 11:28:26 -0500
558
+ # ruby1.class # Time
559
+ #
560
+ #
561
+ # === Custom \JSON Additions
562
+ #
563
+ # In addition to the \JSON additions provided,
564
+ # you can craft \JSON additions of your own,
565
+ # either for Ruby built-in classes or for user-defined classes.
566
+ #
567
+ # Here's a user-defined class +Foo+:
568
+ # class Foo
569
+ # attr_accessor :bar, :baz
570
+ # def initialize(bar, baz)
571
+ # self.bar = bar
572
+ # self.baz = baz
573
+ # end
574
+ # end
575
+ #
576
+ # Here's the \JSON addition for it:
577
+ # # Extend class Foo with JSON addition.
578
+ # class Foo
579
+ # # Serialize Foo object with its class name and arguments
580
+ # def to_json(*args)
581
+ # {
582
+ # JSON.create_id => self.class.name,
583
+ # 'a' => [ bar, baz ]
584
+ # }.to_json(*args)
585
+ # end
586
+ # # Deserialize JSON string by constructing new Foo object with arguments.
587
+ # def self.json_create(object)
588
+ # new(*object['a'])
589
+ # end
590
+ # end
591
+ #
592
+ # Demonstration:
593
+ # require 'json'
594
+ # # This Foo object has no custom addition.
595
+ # foo0 = Foo.new(0, 1)
596
+ # json0 = JSON.generate(foo0)
597
+ # obj0 = JSON.parse(json0)
598
+ # # Lood the custom addition.
599
+ # require_relative 'foo_addition'
600
+ # # This foo has the custom addition.
601
+ # foo1 = Foo.new(0, 1)
602
+ # json1 = JSON.generate(foo1)
603
+ # obj1 = JSON.parse(json1, create_additions: true)
604
+ # # Make a nice display.
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})
612
+ # EOT
613
+ # puts display
614
+ #
615
+ # Output:
616
+ #
617
+ # Generated JSON:
618
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
619
+ # With custom addition: {"json_class":"Foo","a":[0,1]} (String)
620
+ # Parsed JSON:
621
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
622
+ # With custom addition: #<Foo:0x0000000006473bb8 @bar=0, @baz=1> (Foo)
623
+ #
624
+ # source://json//lib/json/version.rb#3
625
+ module JSON
626
+ private
627
+
628
+ # :call-seq:
629
+ # JSON.dump(obj, io = nil, limit = nil)
630
+ #
631
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
632
+ #
633
+ # The default options can be changed via method JSON.dump_default_options.
634
+ #
635
+ # - Argument +io+, if given, should respond to method +write+;
636
+ # the \JSON \String is written to +io+, and +io+ is returned.
637
+ # If +io+ is not given, the \JSON \String is returned.
638
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
639
+ #
640
+ # ---
641
+ #
642
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
643
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
644
+ # json = JSON.dump(obj)
645
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
646
+ #
647
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
648
+ # path = 't.json'
649
+ # File.open(path, 'w') do |file|
650
+ # JSON.dump(obj, file)
651
+ # end # => #<File:t.json (closed)>
652
+ # puts File.read(path)
653
+ # Output:
654
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
655
+ #
656
+ # source://json//lib/json/common.rb#820
657
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
658
+
659
+ # :call-seq:
660
+ # JSON.fast_generate(obj, opts) -> new_string
661
+ #
662
+ # Arguments +obj+ and +opts+ here are the same as
663
+ # arguments +obj+ and +opts+ in JSON.generate.
664
+ #
665
+ # By default, generates \JSON data without checking
666
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
667
+ #
668
+ # Raises an exception if +obj+ contains circular references:
669
+ # a = []; b = []; a.push(b); b.push(a)
670
+ # # Raises SystemStackError (stack level too deep):
671
+ # JSON.fast_generate(a)
672
+ #
673
+ # source://json//lib/json/common.rb#354
674
+ def fast_generate(obj, opts = T.unsafe(nil)); end
675
+
676
+ # :stopdoc:
677
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
678
+ #
679
+ # source://json//lib/json/common.rb#354
680
+ def fast_unparse(obj, opts = T.unsafe(nil)); end
681
+
682
+ # :call-seq:
683
+ # JSON.generate(obj, opts = nil) -> new_string
684
+ #
685
+ # Returns a \String containing the generated \JSON data.
686
+ #
687
+ # See also JSON.fast_generate, JSON.pretty_generate.
688
+ #
689
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
690
+ #
691
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
692
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
693
+ #
694
+ # ---
695
+ #
696
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
697
+ # obj = ["foo", 1.0, true, false, nil]
698
+ # json = JSON.generate(obj)
699
+ # json # => '["foo",1.0,true,false,null]'
700
+ #
701
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
702
+ # obj = {foo: 0, bar: 's', baz: :bat}
703
+ # json = JSON.generate(obj)
704
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
705
+ #
706
+ # For examples of generating from other Ruby objects, see
707
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
708
+ #
709
+ # ---
710
+ #
711
+ # Raises an exception if any formatting option is not a \String.
712
+ #
713
+ # Raises an exception if +obj+ contains circular references:
714
+ # a = []; b = []; a.push(b); b.push(a)
715
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
716
+ # JSON.generate(a)
717
+ #
718
+ # source://json//lib/json/common.rb#326
719
+ def generate(obj, opts = T.unsafe(nil)); end
720
+
721
+ # :call-seq:
722
+ # JSON.load(source, proc = nil, options = {}) -> object
723
+ #
724
+ # Returns the Ruby objects created by parsing the given +source+.
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
+ #
736
+ # - Argument +source+ must be, or be convertible to, a \String:
737
+ # - If +source+ responds to instance method +to_str+,
738
+ # <tt>source.to_str</tt> becomes the source.
739
+ # - If +source+ responds to instance method +to_io+,
740
+ # <tt>source.to_io.read</tt> becomes the source.
741
+ # - If +source+ responds to instance method +read+,
742
+ # <tt>source.read</tt> becomes the source.
743
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
744
+ # - Option +allow_blank+ specifies a truthy value.
745
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
746
+ # - Otherwise, +source+ remains the source.
747
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
748
+ # It will be called recursively with each result (depth-first order).
749
+ # See details below.
750
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
751
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
752
+ # The default options can be changed via method JSON.load_default_options=.
753
+ #
754
+ # ---
755
+ #
756
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
757
+ # <tt>parse(source, opts)</tt>; see #parse.
758
+ #
759
+ # Source for following examples:
760
+ # source = <<~JSON
761
+ # {
762
+ # "name": "Dave",
763
+ # "age" :40,
764
+ # "hats": [
765
+ # "Cattleman's",
766
+ # "Panama",
767
+ # "Tophat"
768
+ # ]
769
+ # }
770
+ # JSON
771
+ #
772
+ # Load a \String:
773
+ # ruby = JSON.load(source)
774
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
775
+ #
776
+ # Load an \IO object:
777
+ # require 'stringio'
778
+ # object = JSON.load(StringIO.new(source))
779
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
780
+ #
781
+ # Load a \File object:
782
+ # path = 't.json'
783
+ # File.write(path, source)
784
+ # File.open(path) do |file|
785
+ # JSON.load(file)
786
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
787
+ #
788
+ # ---
789
+ #
790
+ # When +proc+ is given:
791
+ # - Modifies +source+ as above.
792
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
793
+ # - Recursively calls <tt>proc(result)</tt>.
794
+ # - Returns the final result.
795
+ #
796
+ # Example:
797
+ # require 'json'
798
+ #
799
+ # # Some classes for the example.
800
+ # class Base
801
+ # def initialize(attributes)
802
+ # @attributes = attributes
803
+ # end
804
+ # end
805
+ # class User < Base; end
806
+ # class Account < Base; end
807
+ # class Admin < Base; end
808
+ # # The JSON source.
809
+ # json = <<-EOF
810
+ # {
811
+ # "users": [
812
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
813
+ # {"type": "User", "username": "john", "email": "john@example.com"}
814
+ # ],
815
+ # "accounts": [
816
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
817
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
818
+ # ],
819
+ # "admins": {"type": "Admin", "password": "0wn3d"}
820
+ # }
821
+ # EOF
822
+ # # Deserializer method.
823
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
824
+ # type = obj.is_a?(Hash) && obj["type"]
825
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
826
+ # end
827
+ # # Call to JSON.load
828
+ # ruby = JSON.load(json, proc {|obj|
829
+ # case obj
830
+ # when Hash
831
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
832
+ # when Array
833
+ # obj.map! {|v| deserialize_obj v }
834
+ # end
835
+ # })
836
+ # pp ruby
837
+ # Output:
838
+ # {"users"=>
839
+ # [#<User:0x00000000064c4c98
840
+ # @attributes=
841
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
842
+ # #<User:0x00000000064c4bd0
843
+ # @attributes=
844
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
845
+ # "accounts"=>
846
+ # [{"account"=>
847
+ # #<Account:0x00000000064c4928
848
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
849
+ # {"account"=>
850
+ # #<Account:0x00000000064c4680
851
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
852
+ # "admins"=>
853
+ # #<Admin:0x00000000064c41f8
854
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
855
+ #
856
+ # source://json//lib/json/common.rb#739
857
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
858
+
859
+ # :call-seq:
860
+ # JSON.load_file(path, opts={}) -> object
861
+ #
862
+ # Calls:
863
+ # parse(File.read(path), opts)
864
+ #
865
+ # See method #parse.
866
+ #
867
+ # source://json//lib/json/common.rb#275
868
+ def load_file(filespec, opts = T.unsafe(nil)); end
869
+
870
+ # :call-seq:
871
+ # JSON.load_file!(path, opts = {})
872
+ #
873
+ # Calls:
874
+ # JSON.parse!(File.read(path, opts))
875
+ #
876
+ # See method #parse!
877
+ #
878
+ # source://json//lib/json/common.rb#286
879
+ def load_file!(filespec, opts = T.unsafe(nil)); end
880
+
881
+ # source://json//lib/json/common.rb#857
882
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
883
+
884
+ # :call-seq:
885
+ # JSON.parse(source, opts) -> object
886
+ #
887
+ # Returns the Ruby objects created by parsing the given +source+.
888
+ #
889
+ # Argument +source+ contains the \String to be parsed.
890
+ #
891
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
892
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
893
+ #
894
+ # ---
895
+ #
896
+ # When +source+ is a \JSON array, returns a Ruby \Array:
897
+ # source = '["foo", 1.0, true, false, null]'
898
+ # ruby = JSON.parse(source)
899
+ # ruby # => ["foo", 1.0, true, false, nil]
900
+ # ruby.class # => Array
901
+ #
902
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
903
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
904
+ # ruby = JSON.parse(source)
905
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
906
+ # ruby.class # => Hash
907
+ #
908
+ # For examples of parsing for all \JSON data types, see
909
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
910
+ #
911
+ # Parses nested JSON objects:
912
+ # source = <<~JSON
913
+ # {
914
+ # "name": "Dave",
915
+ # "age" :40,
916
+ # "hats": [
917
+ # "Cattleman's",
918
+ # "Panama",
919
+ # "Tophat"
920
+ # ]
921
+ # }
922
+ # JSON
923
+ # ruby = JSON.parse(source)
924
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
925
+ #
926
+ # ---
927
+ #
928
+ # Raises an exception if +source+ is not valid JSON:
929
+ # # Raises JSON::ParserError (783: unexpected token at ''):
930
+ # JSON.parse('')
931
+ #
932
+ # source://json//lib/json/common.rb#244
933
+ def parse(source, opts = T.unsafe(nil)); end
934
+
935
+ # :call-seq:
936
+ # JSON.parse!(source, opts) -> object
937
+ #
938
+ # Calls
939
+ # parse(source, opts)
940
+ # with +source+ and possibly modified +opts+.
941
+ #
942
+ # Differences from JSON.parse:
943
+ # - Option +max_nesting+, if not provided, defaults to +false+,
944
+ # which disables checking for nesting depth.
945
+ # - Option +allow_nan+, if not provided, defaults to +true+.
946
+ #
947
+ # source://json//lib/json/common.rb#259
948
+ def parse!(source, opts = T.unsafe(nil)); end
949
+
950
+ # :call-seq:
951
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
952
+ #
953
+ # Arguments +obj+ and +opts+ here are the same as
954
+ # arguments +obj+ and +opts+ in JSON.generate.
955
+ #
956
+ # Default options are:
957
+ # {
958
+ # indent: ' ', # Two spaces
959
+ # space: ' ', # One space
960
+ # array_nl: "\n", # Newline
961
+ # object_nl: "\n" # Newline
962
+ # }
963
+ #
964
+ # Example:
965
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
966
+ # json = JSON.pretty_generate(obj)
967
+ # puts json
968
+ # Output:
969
+ # {
970
+ # "foo": [
971
+ # "bar",
972
+ # "baz"
973
+ # ],
974
+ # "bat": {
975
+ # "bam": 0,
976
+ # "bad": 1
977
+ # }
978
+ # }
979
+ #
980
+ # source://json//lib/json/common.rb#399
981
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
982
+
983
+ # :stopdoc:
984
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
985
+ #
986
+ # source://json//lib/json/common.rb#399
987
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
988
+
989
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
990
+ #
991
+ # source://json//lib/json/common.rb#765
992
+ def recurse_proc(result, &proc); end
993
+
994
+ # source://json//lib/json/common.rb#739
995
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
996
+
997
+ # :stopdoc:
998
+ # I want to deprecate these later, so I'll first be silent about them, and
999
+ # later delete them.
1000
+ #
1001
+ # source://json//lib/json/common.rb#326
1002
+ def unparse(obj, opts = T.unsafe(nil)); end
1003
+
1004
+ # :call-seq:
1005
+ # JSON.unsafe_load(source, proc = nil, options = {}) -> object
1006
+ #
1007
+ # Returns the Ruby objects created by parsing the given +source+.
1008
+ #
1009
+ # BEWARE: This method is meant to serialise data from trusted user input,
1010
+ # like from your own database server or clients under your control, it could
1011
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1012
+ #
1013
+ # - Argument +source+ must be, or be convertible to, a \String:
1014
+ # - If +source+ responds to instance method +to_str+,
1015
+ # <tt>source.to_str</tt> becomes the source.
1016
+ # - If +source+ responds to instance method +to_io+,
1017
+ # <tt>source.to_io.read</tt> becomes the source.
1018
+ # - If +source+ responds to instance method +read+,
1019
+ # <tt>source.read</tt> becomes the source.
1020
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1021
+ # - Option +allow_blank+ specifies a truthy value.
1022
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1023
+ # - Otherwise, +source+ remains the source.
1024
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1025
+ # It will be called recursively with each result (depth-first order).
1026
+ # See details below.
1027
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1028
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1029
+ # The default options can be changed via method JSON.unsafe_load_default_options=.
1030
+ #
1031
+ # ---
1032
+ #
1033
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1034
+ # <tt>parse(source, opts)</tt>; see #parse.
1035
+ #
1036
+ # Source for following examples:
1037
+ # source = <<~JSON
1038
+ # {
1039
+ # "name": "Dave",
1040
+ # "age" :40,
1041
+ # "hats": [
1042
+ # "Cattleman's",
1043
+ # "Panama",
1044
+ # "Tophat"
1045
+ # ]
1046
+ # }
1047
+ # JSON
1048
+ #
1049
+ # Load a \String:
1050
+ # ruby = JSON.unsafe_load(source)
1051
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1052
+ #
1053
+ # Load an \IO object:
1054
+ # require 'stringio'
1055
+ # object = JSON.unsafe_load(StringIO.new(source))
1056
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1057
+ #
1058
+ # Load a \File object:
1059
+ # path = 't.json'
1060
+ # File.write(path, source)
1061
+ # File.open(path) do |file|
1062
+ # JSON.unsafe_load(file)
1063
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1064
+ #
1065
+ # ---
1066
+ #
1067
+ # When +proc+ is given:
1068
+ # - Modifies +source+ as above.
1069
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1070
+ # - Recursively calls <tt>proc(result)</tt>.
1071
+ # - Returns the final result.
1072
+ #
1073
+ # Example:
1074
+ # require 'json'
1075
+ #
1076
+ # # Some classes for the example.
1077
+ # class Base
1078
+ # def initialize(attributes)
1079
+ # @attributes = attributes
1080
+ # end
1081
+ # end
1082
+ # class User < Base; end
1083
+ # class Account < Base; end
1084
+ # class Admin < Base; end
1085
+ # # The JSON source.
1086
+ # json = <<-EOF
1087
+ # {
1088
+ # "users": [
1089
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1090
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1091
+ # ],
1092
+ # "accounts": [
1093
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1094
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1095
+ # ],
1096
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1097
+ # }
1098
+ # EOF
1099
+ # # Deserializer method.
1100
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1101
+ # type = obj.is_a?(Hash) && obj["type"]
1102
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1103
+ # end
1104
+ # # Call to JSON.unsafe_load
1105
+ # ruby = JSON.unsafe_load(json, proc {|obj|
1106
+ # case obj
1107
+ # when Hash
1108
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1109
+ # when Array
1110
+ # obj.map! {|v| deserialize_obj v }
1111
+ # end
1112
+ # })
1113
+ # pp ruby
1114
+ # Output:
1115
+ # {"users"=>
1116
+ # [#<User:0x00000000064c4c98
1117
+ # @attributes=
1118
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1119
+ # #<User:0x00000000064c4bd0
1120
+ # @attributes=
1121
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1122
+ # "accounts"=>
1123
+ # [{"account"=>
1124
+ # #<Account:0x00000000064c4928
1125
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1126
+ # {"account"=>
1127
+ # #<Account:0x00000000064c4680
1128
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1129
+ # "admins"=>
1130
+ # #<Admin:0x00000000064c41f8
1131
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1132
+ #
1133
+ # source://json//lib/json/common.rb#579
1134
+ def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1135
+
1136
+ class << self
1137
+ # :call-seq:
1138
+ # JSON[object] -> new_array or new_string
1139
+ #
1140
+ # If +object+ is a \String,
1141
+ # calls JSON.parse with +object+ and +opts+ (see method #parse):
1142
+ # json = '[0, 1, null]'
1143
+ # JSON[json]# => [0, 1, nil]
1144
+ #
1145
+ # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
1146
+ # ruby = [0, 1, nil]
1147
+ # JSON[ruby] # => '[0,1,null]'
1148
+ #
1149
+ # source://json//lib/json/common.rb#23
1150
+ def [](object, opts = T.unsafe(nil)); end
1151
+
1152
+ # source://json//lib/json/common.rb#80
1153
+ def create_fast_state; end
1154
+
1155
+ # Returns the current create identifier.
1156
+ # See also JSON.create_id=.
1157
+ #
1158
+ # source://json//lib/json/common.rb#115
1159
+ def create_id; end
1160
+
1161
+ # Sets create identifier, which is used to decide if the _json_create_
1162
+ # hook of a class should be called; initial value is +json_class+:
1163
+ # JSON.create_id # => 'json_class'
1164
+ #
1165
+ # source://json//lib/json/common.rb#109
1166
+ def create_id=(new_value); end
1167
+
1168
+ # source://json//lib/json/common.rb#90
1169
+ def create_pretty_state; end
1170
+
1171
+ # Return the constant located at _path_. The format of _path_ has to be
1172
+ # either ::A::B::C or A::B::C. In any case, A has to be located at the top
1173
+ # level (absolute namespace path?). If there doesn't exist a constant at
1174
+ # the given path, an ArgumentError is raised.
1175
+ #
1176
+ # source://json//lib/json/common.rb#50
1177
+ def deep_const_get(path); end
1178
+
1179
+ # :call-seq:
1180
+ # JSON.dump(obj, io = nil, limit = nil)
1181
+ #
1182
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
1183
+ #
1184
+ # The default options can be changed via method JSON.dump_default_options.
1185
+ #
1186
+ # - Argument +io+, if given, should respond to method +write+;
1187
+ # the \JSON \String is written to +io+, and +io+ is returned.
1188
+ # If +io+ is not given, the \JSON \String is returned.
1189
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
1190
+ #
1191
+ # ---
1192
+ #
1193
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
1194
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
1195
+ # json = JSON.dump(obj)
1196
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
1197
+ #
1198
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
1199
+ # path = 't.json'
1200
+ # File.open(path, 'w') do |file|
1201
+ # JSON.dump(obj, file)
1202
+ # end # => #<File:t.json (closed)>
1203
+ # puts File.read(path)
1204
+ # Output:
1205
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1206
+ #
1207
+ # source://json//lib/json/common.rb#820
1208
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1209
+
1210
+ # Sets or returns the default options for the JSON.dump method.
1211
+ # Initially:
1212
+ # opts = JSON.dump_default_options
1213
+ # opts # => {:max_nesting=>false, :allow_nan=>true}
1214
+ #
1215
+ # source://json//lib/json/common.rb#786
1216
+ def dump_default_options; end
1217
+
1218
+ # Sets or returns the default options for the JSON.dump method.
1219
+ # Initially:
1220
+ # opts = JSON.dump_default_options
1221
+ # opts # => {:max_nesting=>false, :allow_nan=>true}
1222
+ #
1223
+ # source://json//lib/json/common.rb#786
1224
+ def dump_default_options=(_arg0); end
1225
+
1226
+ # :call-seq:
1227
+ # JSON.fast_generate(obj, opts) -> new_string
1228
+ #
1229
+ # Arguments +obj+ and +opts+ here are the same as
1230
+ # arguments +obj+ and +opts+ in JSON.generate.
1231
+ #
1232
+ # By default, generates \JSON data without checking
1233
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
1234
+ #
1235
+ # Raises an exception if +obj+ contains circular references:
1236
+ # a = []; b = []; a.push(b); b.push(a)
1237
+ # # Raises SystemStackError (stack level too deep):
1238
+ # JSON.fast_generate(a)
1239
+ #
1240
+ # source://json//lib/json/common.rb#354
1241
+ def fast_generate(obj, opts = T.unsafe(nil)); end
1242
+
1243
+ # :stopdoc:
1244
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1245
+ #
1246
+ # source://json//lib/json/common.rb#354
1247
+ def fast_unparse(obj, opts = T.unsafe(nil)); end
1248
+
1249
+ # :call-seq:
1250
+ # JSON.generate(obj, opts = nil) -> new_string
1251
+ #
1252
+ # Returns a \String containing the generated \JSON data.
1253
+ #
1254
+ # See also JSON.fast_generate, JSON.pretty_generate.
1255
+ #
1256
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
1257
+ #
1258
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
1259
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
1260
+ #
1261
+ # ---
1262
+ #
1263
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
1264
+ # obj = ["foo", 1.0, true, false, nil]
1265
+ # json = JSON.generate(obj)
1266
+ # json # => '["foo",1.0,true,false,null]'
1267
+ #
1268
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
1269
+ # obj = {foo: 0, bar: 's', baz: :bat}
1270
+ # json = JSON.generate(obj)
1271
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
1272
+ #
1273
+ # For examples of generating from other Ruby objects, see
1274
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
1275
+ #
1276
+ # ---
1277
+ #
1278
+ # Raises an exception if any formatting option is not a \String.
1279
+ #
1280
+ # Raises an exception if +obj+ contains circular references:
1281
+ # a = []; b = []; a.push(b); b.push(a)
1282
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
1283
+ # JSON.generate(a)
1284
+ #
1285
+ # source://json//lib/json/common.rb#326
1286
+ def generate(obj, opts = T.unsafe(nil)); end
1287
+
1288
+ # Returns the JSON generator module that is used by JSON.
1289
+ #
1290
+ # source://json//lib/json/common.rb#100
1291
+ def generator; end
1292
+
1293
+ # Set the module _generator_ to be used by JSON.
1294
+ #
1295
+ # source://json//lib/json/common.rb#57
1296
+ def generator=(generator); end
1297
+
1298
+ # Encodes string using String.encode.
1299
+ #
1300
+ # source://json//lib/json/common.rb#853
1301
+ def iconv(to, from, string); end
1302
+
1303
+ # :call-seq:
1304
+ # JSON.load(source, proc = nil, options = {}) -> object
1305
+ #
1306
+ # Returns the Ruby objects created by parsing the given +source+.
1307
+ #
1308
+ # BEWARE: This method is meant to serialise data from trusted user input,
1309
+ # like from your own database server or clients under your control, it could
1310
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1311
+ # If you must use it, use JSON.unsafe_load instead to make it clear.
1312
+ #
1313
+ # Since JSON version 2.8.0, `load` emits a deprecation warning when a
1314
+ # non native type is deserialized, without `create_additions` being explicitly
1315
+ # enabled, and in JSON version 3.0, `load` will have `create_additions` disabled
1316
+ # by default.
1317
+ #
1318
+ # - Argument +source+ must be, or be convertible to, a \String:
1319
+ # - If +source+ responds to instance method +to_str+,
1320
+ # <tt>source.to_str</tt> becomes the source.
1321
+ # - If +source+ responds to instance method +to_io+,
1322
+ # <tt>source.to_io.read</tt> becomes the source.
1323
+ # - If +source+ responds to instance method +read+,
1324
+ # <tt>source.read</tt> becomes the source.
1325
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1326
+ # - Option +allow_blank+ specifies a truthy value.
1327
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1328
+ # - Otherwise, +source+ remains the source.
1329
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1330
+ # It will be called recursively with each result (depth-first order).
1331
+ # See details below.
1332
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1333
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1334
+ # The default options can be changed via method JSON.load_default_options=.
1335
+ #
1336
+ # ---
1337
+ #
1338
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1339
+ # <tt>parse(source, opts)</tt>; see #parse.
1340
+ #
1341
+ # Source for following examples:
1342
+ # source = <<~JSON
1343
+ # {
1344
+ # "name": "Dave",
1345
+ # "age" :40,
1346
+ # "hats": [
1347
+ # "Cattleman's",
1348
+ # "Panama",
1349
+ # "Tophat"
1350
+ # ]
1351
+ # }
1352
+ # JSON
1353
+ #
1354
+ # Load a \String:
1355
+ # ruby = JSON.load(source)
1356
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1357
+ #
1358
+ # Load an \IO object:
1359
+ # require 'stringio'
1360
+ # object = JSON.load(StringIO.new(source))
1361
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1362
+ #
1363
+ # Load a \File object:
1364
+ # path = 't.json'
1365
+ # File.write(path, source)
1366
+ # File.open(path) do |file|
1367
+ # JSON.load(file)
1368
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1369
+ #
1370
+ # ---
1371
+ #
1372
+ # When +proc+ is given:
1373
+ # - Modifies +source+ as above.
1374
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1375
+ # - Recursively calls <tt>proc(result)</tt>.
1376
+ # - Returns the final result.
1377
+ #
1378
+ # Example:
1379
+ # require 'json'
1380
+ #
1381
+ # # Some classes for the example.
1382
+ # class Base
1383
+ # def initialize(attributes)
1384
+ # @attributes = attributes
1385
+ # end
1386
+ # end
1387
+ # class User < Base; end
1388
+ # class Account < Base; end
1389
+ # class Admin < Base; end
1390
+ # # The JSON source.
1391
+ # json = <<-EOF
1392
+ # {
1393
+ # "users": [
1394
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1395
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1396
+ # ],
1397
+ # "accounts": [
1398
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1399
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1400
+ # ],
1401
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1402
+ # }
1403
+ # EOF
1404
+ # # Deserializer method.
1405
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1406
+ # type = obj.is_a?(Hash) && obj["type"]
1407
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1408
+ # end
1409
+ # # Call to JSON.load
1410
+ # ruby = JSON.load(json, proc {|obj|
1411
+ # case obj
1412
+ # when Hash
1413
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1414
+ # when Array
1415
+ # obj.map! {|v| deserialize_obj v }
1416
+ # end
1417
+ # })
1418
+ # pp ruby
1419
+ # Output:
1420
+ # {"users"=>
1421
+ # [#<User:0x00000000064c4c98
1422
+ # @attributes=
1423
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1424
+ # #<User:0x00000000064c4bd0
1425
+ # @attributes=
1426
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1427
+ # "accounts"=>
1428
+ # [{"account"=>
1429
+ # #<Account:0x00000000064c4928
1430
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1431
+ # {"account"=>
1432
+ # #<Account:0x00000000064c4680
1433
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1434
+ # "admins"=>
1435
+ # #<Admin:0x00000000064c41f8
1436
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1437
+ #
1438
+ # source://json//lib/json/common.rb#739
1439
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1440
+
1441
+ # Sets or returns default options for the JSON.load method.
1442
+ # Initially:
1443
+ # opts = JSON.load_default_options
1444
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1445
+ #
1446
+ # source://json//lib/json/common.rb#443
1447
+ def load_default_options; end
1448
+
1449
+ # Sets or returns default options for the JSON.load method.
1450
+ # Initially:
1451
+ # opts = JSON.load_default_options
1452
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1453
+ #
1454
+ # source://json//lib/json/common.rb#443
1455
+ def load_default_options=(_arg0); end
1456
+
1457
+ # :call-seq:
1458
+ # JSON.load_file(path, opts={}) -> object
1459
+ #
1460
+ # Calls:
1461
+ # parse(File.read(path), opts)
1462
+ #
1463
+ # See method #parse.
1464
+ #
1465
+ # source://json//lib/json/common.rb#275
1466
+ def load_file(filespec, opts = T.unsafe(nil)); end
1467
+
1468
+ # :call-seq:
1469
+ # JSON.load_file!(path, opts = {})
1470
+ #
1471
+ # Calls:
1472
+ # JSON.parse!(File.read(path, opts))
1473
+ #
1474
+ # See method #parse!
1475
+ #
1476
+ # source://json//lib/json/common.rb#286
1477
+ def load_file!(filespec, opts = T.unsafe(nil)); end
1478
+
1479
+ # :call-seq:
1480
+ # JSON.parse(source, opts) -> object
1481
+ #
1482
+ # Returns the Ruby objects created by parsing the given +source+.
1483
+ #
1484
+ # Argument +source+ contains the \String to be parsed.
1485
+ #
1486
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
1487
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1488
+ #
1489
+ # ---
1490
+ #
1491
+ # When +source+ is a \JSON array, returns a Ruby \Array:
1492
+ # source = '["foo", 1.0, true, false, null]'
1493
+ # ruby = JSON.parse(source)
1494
+ # ruby # => ["foo", 1.0, true, false, nil]
1495
+ # ruby.class # => Array
1496
+ #
1497
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
1498
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
1499
+ # ruby = JSON.parse(source)
1500
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
1501
+ # ruby.class # => Hash
1502
+ #
1503
+ # For examples of parsing for all \JSON data types, see
1504
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
1505
+ #
1506
+ # Parses nested JSON objects:
1507
+ # source = <<~JSON
1508
+ # {
1509
+ # "name": "Dave",
1510
+ # "age" :40,
1511
+ # "hats": [
1512
+ # "Cattleman's",
1513
+ # "Panama",
1514
+ # "Tophat"
1515
+ # ]
1516
+ # }
1517
+ # JSON
1518
+ # ruby = JSON.parse(source)
1519
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1520
+ #
1521
+ # ---
1522
+ #
1523
+ # Raises an exception if +source+ is not valid JSON:
1524
+ # # Raises JSON::ParserError (783: unexpected token at ''):
1525
+ # JSON.parse('')
1526
+ #
1527
+ # source://json//lib/json/common.rb#244
1528
+ def parse(source, opts = T.unsafe(nil)); end
1529
+
1530
+ # :call-seq:
1531
+ # JSON.parse!(source, opts) -> object
1532
+ #
1533
+ # Calls
1534
+ # parse(source, opts)
1535
+ # with +source+ and possibly modified +opts+.
1536
+ #
1537
+ # Differences from JSON.parse:
1538
+ # - Option +max_nesting+, if not provided, defaults to +false+,
1539
+ # which disables checking for nesting depth.
1540
+ # - Option +allow_nan+, if not provided, defaults to +true+.
1541
+ #
1542
+ # source://json//lib/json/common.rb#259
1543
+ def parse!(source, opts = T.unsafe(nil)); end
1544
+
1545
+ # Returns the JSON parser class that is used by JSON.
1546
+ #
1547
+ # source://json//lib/json/common.rb#37
1548
+ def parser; end
1549
+
1550
+ # Set the JSON parser class _parser_ to be used by JSON.
1551
+ #
1552
+ # source://json//lib/json/common.rb#40
1553
+ def parser=(parser); end
1554
+
1555
+ # :call-seq:
1556
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
1557
+ #
1558
+ # Arguments +obj+ and +opts+ here are the same as
1559
+ # arguments +obj+ and +opts+ in JSON.generate.
1560
+ #
1561
+ # Default options are:
1562
+ # {
1563
+ # indent: ' ', # Two spaces
1564
+ # space: ' ', # One space
1565
+ # array_nl: "\n", # Newline
1566
+ # object_nl: "\n" # Newline
1567
+ # }
1568
+ #
1569
+ # Example:
1570
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
1571
+ # json = JSON.pretty_generate(obj)
1572
+ # puts json
1573
+ # Output:
1574
+ # {
1575
+ # "foo": [
1576
+ # "bar",
1577
+ # "baz"
1578
+ # ],
1579
+ # "bat": {
1580
+ # "bam": 0,
1581
+ # "bad": 1
1582
+ # }
1583
+ # }
1584
+ #
1585
+ # source://json//lib/json/common.rb#399
1586
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
1587
+
1588
+ # :stopdoc:
1589
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1590
+ #
1591
+ # source://json//lib/json/common.rb#399
1592
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
1593
+
1594
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1595
+ #
1596
+ # source://json//lib/json/common.rb#765
1597
+ def recurse_proc(result, &proc); end
1598
+
1599
+ # source://json//lib/json/common.rb#739
1600
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1601
+
1602
+ # Sets or Returns the JSON generator state class that is used by JSON.
1603
+ #
1604
+ # source://json//lib/json/common.rb#103
1605
+ def state; end
1606
+
1607
+ # Sets or Returns the JSON generator state class that is used by JSON.
1608
+ #
1609
+ # source://json//lib/json/common.rb#103
1610
+ def state=(_arg0); end
1611
+
1612
+ # :stopdoc:
1613
+ # I want to deprecate these later, so I'll first be silent about them, and
1614
+ # later delete them.
1615
+ #
1616
+ # source://json//lib/json/common.rb#326
1617
+ def unparse(obj, opts = T.unsafe(nil)); end
1618
+
1619
+ # :call-seq:
1620
+ # JSON.unsafe_load(source, proc = nil, options = {}) -> object
1621
+ #
1622
+ # Returns the Ruby objects created by parsing the given +source+.
1623
+ #
1624
+ # BEWARE: This method is meant to serialise data from trusted user input,
1625
+ # like from your own database server or clients under your control, it could
1626
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1627
+ #
1628
+ # - Argument +source+ must be, or be convertible to, a \String:
1629
+ # - If +source+ responds to instance method +to_str+,
1630
+ # <tt>source.to_str</tt> becomes the source.
1631
+ # - If +source+ responds to instance method +to_io+,
1632
+ # <tt>source.to_io.read</tt> becomes the source.
1633
+ # - If +source+ responds to instance method +read+,
1634
+ # <tt>source.read</tt> becomes the source.
1635
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1636
+ # - Option +allow_blank+ specifies a truthy value.
1637
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1638
+ # - Otherwise, +source+ remains the source.
1639
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1640
+ # It will be called recursively with each result (depth-first order).
1641
+ # See details below.
1642
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1643
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1644
+ # The default options can be changed via method JSON.unsafe_load_default_options=.
1645
+ #
1646
+ # ---
1647
+ #
1648
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1649
+ # <tt>parse(source, opts)</tt>; see #parse.
1650
+ #
1651
+ # Source for following examples:
1652
+ # source = <<~JSON
1653
+ # {
1654
+ # "name": "Dave",
1655
+ # "age" :40,
1656
+ # "hats": [
1657
+ # "Cattleman's",
1658
+ # "Panama",
1659
+ # "Tophat"
1660
+ # ]
1661
+ # }
1662
+ # JSON
1663
+ #
1664
+ # Load a \String:
1665
+ # ruby = JSON.unsafe_load(source)
1666
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1667
+ #
1668
+ # Load an \IO object:
1669
+ # require 'stringio'
1670
+ # object = JSON.unsafe_load(StringIO.new(source))
1671
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1672
+ #
1673
+ # Load a \File object:
1674
+ # path = 't.json'
1675
+ # File.write(path, source)
1676
+ # File.open(path) do |file|
1677
+ # JSON.unsafe_load(file)
1678
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1679
+ #
1680
+ # ---
1681
+ #
1682
+ # When +proc+ is given:
1683
+ # - Modifies +source+ as above.
1684
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1685
+ # - Recursively calls <tt>proc(result)</tt>.
1686
+ # - Returns the final result.
1687
+ #
1688
+ # Example:
1689
+ # require 'json'
1690
+ #
1691
+ # # Some classes for the example.
1692
+ # class Base
1693
+ # def initialize(attributes)
1694
+ # @attributes = attributes
1695
+ # end
1696
+ # end
1697
+ # class User < Base; end
1698
+ # class Account < Base; end
1699
+ # class Admin < Base; end
1700
+ # # The JSON source.
1701
+ # json = <<-EOF
1702
+ # {
1703
+ # "users": [
1704
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1705
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1706
+ # ],
1707
+ # "accounts": [
1708
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1709
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1710
+ # ],
1711
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1712
+ # }
1713
+ # EOF
1714
+ # # Deserializer method.
1715
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1716
+ # type = obj.is_a?(Hash) && obj["type"]
1717
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1718
+ # end
1719
+ # # Call to JSON.unsafe_load
1720
+ # ruby = JSON.unsafe_load(json, proc {|obj|
1721
+ # case obj
1722
+ # when Hash
1723
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1724
+ # when Array
1725
+ # obj.map! {|v| deserialize_obj v }
1726
+ # end
1727
+ # })
1728
+ # pp ruby
1729
+ # Output:
1730
+ # {"users"=>
1731
+ # [#<User:0x00000000064c4c98
1732
+ # @attributes=
1733
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1734
+ # #<User:0x00000000064c4bd0
1735
+ # @attributes=
1736
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1737
+ # "accounts"=>
1738
+ # [{"account"=>
1739
+ # #<Account:0x00000000064c4928
1740
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1741
+ # {"account"=>
1742
+ # #<Account:0x00000000064c4680
1743
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1744
+ # "admins"=>
1745
+ # #<Admin:0x00000000064c41f8
1746
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1747
+ #
1748
+ # source://json//lib/json/common.rb#579
1749
+ def unsafe_load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1750
+
1751
+ # Sets or returns default options for the JSON.unsafe_load method.
1752
+ # Initially:
1753
+ # opts = JSON.load_default_options
1754
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1755
+ #
1756
+ # source://json//lib/json/common.rb#429
1757
+ def unsafe_load_default_options; end
1758
+
1759
+ # Sets or returns default options for the JSON.unsafe_load method.
1760
+ # Initially:
1761
+ # opts = JSON.load_default_options
1762
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1763
+ #
1764
+ # source://json//lib/json/common.rb#429
1765
+ def unsafe_load_default_options=(_arg0); end
1766
+
1767
+ private
1768
+
1769
+ # source://json//lib/json/common.rb#857
1770
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
1771
+ end
1772
+ end
1773
+
1774
+ # JSON::Coder holds a parser and generator configuration.
1775
+ #
1776
+ # module MyApp
1777
+ # JSONC_CODER = JSON::Coder.new(
1778
+ # allow_trailing_comma: true
1779
+ # )
1780
+ # end
1781
+ #
1782
+ # MyApp::JSONC_CODER.load(document)
1783
+ #
1784
+ # source://json//lib/json/common.rb#876
1785
+ class JSON::Coder
1786
+ # :call-seq:
1787
+ # JSON.new(options = nil, &block)
1788
+ #
1789
+ # Argument +options+, if given, contains a \Hash of options for both parsing and generating.
1790
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options], and {Generating Options}[#module-JSON-label-Generating+Options].
1791
+ #
1792
+ # For generation, the <tt>strict: true</tt> option is always set. When a Ruby object with no native \JSON counterpart is
1793
+ # encoutered, the block provided to the initialize method is invoked, and must return a Ruby object that has a native
1794
+ # \JSON counterpart:
1795
+ #
1796
+ # module MyApp
1797
+ # API_JSON_CODER = JSON::Coder.new do |object|
1798
+ # case object
1799
+ # when Time
1800
+ # object.iso8601(3)
1801
+ # else
1802
+ # object # Unknown type, will raise
1803
+ # end
1804
+ # end
1805
+ # end
1806
+ #
1807
+ # puts MyApp::API_JSON_CODER.dump(Time.now.utc) # => "2025-01-21T08:41:44.286Z"
1808
+ #
1809
+ # @return [Coder] a new instance of Coder
1810
+ #
1811
+ # source://json//lib/json/common.rb#900
1812
+ def initialize(options = T.unsafe(nil), &as_json); end
1813
+
1814
+ # call-seq:
1815
+ # dump(object) -> String
1816
+ # dump(object, io) -> io
1817
+ #
1818
+ # Serialize the given object into a \JSON document.
1819
+ #
1820
+ # source://json//lib/json/common.rb#919
1821
+ def dump(object, io = T.unsafe(nil)); end
1822
+
1823
+ # call-seq:
1824
+ # dump(object) -> String
1825
+ # dump(object, io) -> io
1826
+ #
1827
+ # Serialize the given object into a \JSON document.
1828
+ #
1829
+ # source://json//lib/json/common.rb#919
1830
+ def generate(object, io = T.unsafe(nil)); end
1831
+
1832
+ # call-seq:
1833
+ # load(string) -> Object
1834
+ #
1835
+ # Parse the given \JSON document and return an equivalent Ruby object.
1836
+ #
1837
+ # source://json//lib/json/common.rb#928
1838
+ def load(source); end
1839
+
1840
+ # call-seq:
1841
+ # load(path) -> Object
1842
+ #
1843
+ # Parse the given \JSON document and return an equivalent Ruby object.
1844
+ #
1845
+ # source://json//lib/json/common.rb#937
1846
+ def load_file(path); end
1847
+
1848
+ # call-seq:
1849
+ # load(string) -> Object
1850
+ #
1851
+ # Parse the given \JSON document and return an equivalent Ruby object.
1852
+ #
1853
+ # source://json//lib/json/common.rb#928
1854
+ def parse(source); end
1855
+ end
1856
+
1857
+ module JSON::Ext::Generator::GeneratorMethods::String
1858
+ mixes_in_class_methods ::JSON::Ext::Generator::GeneratorMethods::String::Extend
1859
+ end
1860
+
1861
+ # source://json//lib/json/ext/generator/state.rb#6
1862
+ class JSON::Ext::Generator::State
1863
+ # call-seq: new(opts = {})
1864
+ #
1865
+ # Instantiates a new State object, configured by _opts_.
1866
+ #
1867
+ # _opts_ can have the following keys:
1868
+ #
1869
+ # * *indent*: a string used to indent levels (default: ''),
1870
+ # * *space*: a string that is put after, a : or , delimiter (default: ''),
1871
+ # * *space_before*: a string that is put before a : pair delimiter (default: ''),
1872
+ # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
1873
+ # * *array_nl*: a string that is put at the end of a JSON array (default: ''),
1874
+ # * *allow_nan*: true if NaN, Infinity, and -Infinity should be
1875
+ # generated, otherwise an exception is thrown, if these values are
1876
+ # encountered. This options defaults to false.
1877
+ # * *ascii_only*: true if only ASCII characters should be generated. This
1878
+ # option defaults to false.
1879
+ # * *buffer_initial_length*: sets the initial length of the generator's
1880
+ # internal buffer.
1881
+ #
1882
+ # @return [State] a new instance of State
1883
+ #
1884
+ # source://json//lib/json/ext/generator/state.rb#25
1885
+ def initialize(opts = T.unsafe(nil)); end
1886
+
1887
+ # call-seq: [](name)
1888
+ #
1889
+ # Returns the value returned by method +name+.
1890
+ #
1891
+ # source://json//lib/json/ext/generator/state.rb#84
1892
+ def [](name); end
1893
+
1894
+ # call-seq: []=(name, value)
1895
+ #
1896
+ # Sets the attribute name to value.
1897
+ #
1898
+ # source://json//lib/json/ext/generator/state.rb#96
1899
+ def []=(name, value); 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 configure(opts); end
1908
+
1909
+ # call-seq: configure(opts)
1910
+ #
1911
+ # Configure this State instance with the Hash _opts_, and return
1912
+ # itself.
1913
+ #
1914
+ # source://json//lib/json/ext/generator/state.rb#35
1915
+ def merge(opts); 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_h; end
1924
+
1925
+ # call-seq: to_h
1926
+ #
1927
+ # Returns the configuration instance variables as a hash, that can be
1928
+ # passed to the configure method.
1929
+ #
1930
+ # source://json//lib/json/ext/generator/state.rb#54
1931
+ def to_hash; end
1932
+ end
1933
+
1934
+ # source://json//lib/json/ext.rb#9
1935
+ class JSON::Ext::Parser
1936
+ # @return [Parser] a new instance of Parser
1937
+ #
1938
+ # source://json//lib/json/ext.rb#17
1939
+ def initialize(source, opts = T.unsafe(nil)); end
1940
+
1941
+ # source://json//lib/json/ext.rb#26
1942
+ def parse; end
1943
+
1944
+ # source://json//lib/json/ext.rb#22
1945
+ def source; end
1946
+ end
1947
+
1948
+ # source://json//lib/json/ext.rb#32
1949
+ JSON::Ext::Parser::Config = JSON::Ext::ParserConfig
1950
+
1951
+ # Fragment of JSON document that is to be included as is:
1952
+ # fragment = JSON::Fragment.new("[1, 2, 3]")
1953
+ # JSON.generate({ count: 3, items: fragments })
1954
+ #
1955
+ # This allows to easily assemble multiple JSON fragments that have
1956
+ # been persisted somewhere without having to parse them nor resorting
1957
+ # to string interpolation.
1958
+ #
1959
+ # Note: no validation is performed on the provided string. It is the
1960
+ # responsability of the caller to ensure the string contains valid JSON.
1961
+ #
1962
+ # source://json//lib/json/common.rb#180
1963
+ class JSON::Fragment < ::Struct
1964
+ # @return [Fragment] a new instance of Fragment
1965
+ #
1966
+ # source://json//lib/json/common.rb#181
1967
+ def initialize(json); end
1968
+
1969
+ # Returns the value of attribute json
1970
+ #
1971
+ # @return [Object] the current value of json
1972
+ def json; end
1973
+
1974
+ # Sets the attribute json
1975
+ #
1976
+ # @param value [Object] the value to set the attribute json to.
1977
+ # @return [Object] the newly set value
1978
+ def json=(_); end
1979
+
1980
+ # source://json//lib/json/common.rb#189
1981
+ def to_json(state = T.unsafe(nil), *_arg1); end
1982
+
1983
+ class << self
1984
+ def [](*_arg0); end
1985
+ def inspect; end
1986
+ def keyword_init?; end
1987
+ def members; end
1988
+ def new(*_arg0); end
1989
+ end
1990
+ end
1991
+
1992
+ # This exception is raised if a generator or unparser error occurs.
1993
+ #
1994
+ # source://json//lib/json/common.rb#146
1995
+ class JSON::GeneratorError < ::JSON::JSONError
1996
+ # @return [GeneratorError] a new instance of GeneratorError
1997
+ #
1998
+ # source://json//lib/json/common.rb#149
1999
+ def initialize(message, invalid_object = T.unsafe(nil)); end
2000
+
2001
+ # source://json//lib/json/common.rb#154
2002
+ def detailed_message(*_arg0, **_arg1, &_arg2); end
2003
+
2004
+ # Returns the value of attribute invalid_object.
2005
+ #
2006
+ # source://json//lib/json/common.rb#147
2007
+ def invalid_object; end
2008
+ end
2009
+
2010
+ # source://json//lib/json/generic_object.rb#9
2011
+ class JSON::GenericObject < ::OpenStruct
2012
+ # source://json//lib/json/generic_object.rb#67
2013
+ def as_json(*_arg0); end
2014
+
2015
+ # source://json//lib/json/generic_object.rb#51
2016
+ def to_hash; end
2017
+
2018
+ # source://json//lib/json/generic_object.rb#71
2019
+ def to_json(*a); end
2020
+
2021
+ # source://json//lib/json/generic_object.rb#63
2022
+ def |(other); end
2023
+
2024
+ class << self
2025
+ # source://json//lib/json/generic_object.rb#45
2026
+ def dump(obj, *args); end
2027
+
2028
+ # source://json//lib/json/generic_object.rb#25
2029
+ def from_hash(object); end
2030
+
2031
+ # Sets the attribute json_creatable
2032
+ #
2033
+ # @param value the value to set the attribute json_creatable to.
2034
+ #
2035
+ # source://json//lib/json/generic_object.rb#17
2036
+ def json_creatable=(_arg0); end
2037
+
2038
+ # @return [Boolean]
2039
+ #
2040
+ # source://json//lib/json/generic_object.rb#13
2041
+ def json_creatable?; end
2042
+
2043
+ # source://json//lib/json/generic_object.rb#19
2044
+ def json_create(data); end
2045
+
2046
+ # source://json//lib/json/generic_object.rb#40
2047
+ def load(source, proc = T.unsafe(nil), opts = T.unsafe(nil)); end
2048
+ end
2049
+ end
2050
+
2051
+ # The base exception for JSON errors.
2052
+ #
2053
+ # source://json//lib/json/common.rb#126
2054
+ class JSON::JSONError < ::StandardError
2055
+ class << self
2056
+ # source://json//lib/json/common.rb#127
2057
+ def wrap(exception); end
2058
+ end
2059
+ end
2060
+
2061
+ # source://json//lib/json/common.rb#8
2062
+ JSON::NOT_SET = T.let(T.unsafe(nil), Object)
2063
+
2064
+ # source://json//lib/json/common.rb#43
2065
+ JSON::Parser = JSON::Ext::Parser
2066
+
2067
+ # source://json//lib/json/common.rb#72
2068
+ JSON::State = JSON::Ext::Generator::State
2069
+
2070
+ # For backwards compatibility
2071
+ #
2072
+ # source://json//lib/json/common.rb#164
2073
+ JSON::UnparserError = JSON::GeneratorError
2074
+
2075
+ # source://json//lib/json/common.rb#943
2076
+ module Kernel
2077
+ private
2078
+
2079
+ # If _object_ is string-like, parse the string and return the parsed result as
2080
+ # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
2081
+ # structure object and return it.
2082
+ #
2083
+ # The _opts_ argument is passed through to generate/parse respectively. See
2084
+ # generate and parse for their documentation.
2085
+ #
2086
+ # source://json//lib/json/common.rb#970
2087
+ def JSON(object, *args); end
2088
+
2089
+ # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
2090
+ # one line.
2091
+ #
2092
+ # source://json//lib/json/common.rb#948
2093
+ def j(*objs); end
2094
+
2095
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
2096
+ # indentation and over many lines.
2097
+ #
2098
+ # source://json//lib/json/common.rb#957
2099
+ def jj(*objs); end
2100
+ end
2101
+
2102
+ class NilClass
2103
+ include ::JSON::Ext::Generator::GeneratorMethods::NilClass
2104
+ end
2105
+
2106
+ class Object < ::BasicObject
2107
+ include ::Kernel
2108
+ include ::PP::ObjectMixin
2109
+ include ::JSON::Ext::Generator::GeneratorMethods::Object
2110
+ end
2111
+
2112
+ class String
2113
+ include ::Comparable
2114
+ include ::JSON::Ext::Generator::GeneratorMethods::String
2115
+ extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
2116
+ end
2117
+
2118
+ class TrueClass
2119
+ include ::JSON::Ext::Generator::GeneratorMethods::TrueClass
2120
+ end