geet 0.22.0 → 0.23.0

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +20 -0
  3. data/bin/tapioca +1 -14
  4. data/geet.gemspec +5 -3
  5. data/lib/geet/helpers/os_helper.rb +8 -1
  6. data/lib/geet/version.rb +1 -1
  7. data/sorbet/config +5 -0
  8. data/sorbet/rbi/annotations/.gitattributes +1 -0
  9. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  10. data/sorbet/rbi/annotations/webmock.rbi +9 -0
  11. data/sorbet/rbi/gems/.gitattributes +1 -0
  12. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  13. data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
  14. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  15. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +637 -0
  16. data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +9 -0
  17. data/sorbet/rbi/gems/byebug@11.1.3.rbi +37 -0
  18. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  19. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +1134 -0
  20. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  21. data/sorbet/rbi/gems/hashdiff@1.1.1.rbi +353 -0
  22. data/sorbet/rbi/gems/json@2.7.2.rbi +1608 -0
  23. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  24. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  25. data/sorbet/rbi/gems/ostruct@0.6.3.rbi +354 -0
  26. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  27. data/sorbet/rbi/gems/parseconfig@1.1.2.rbi +9 -0
  28. data/sorbet/rbi/gems/parser@3.3.9.0.rbi +5535 -0
  29. data/sorbet/rbi/gems/pastel@0.8.0.rbi +9 -0
  30. data/sorbet/rbi/gems/prism@1.6.0.rbi +42068 -0
  31. data/sorbet/rbi/gems/public_suffix@6.0.1.rbi +936 -0
  32. data/sorbet/rbi/gems/racc@1.8.1.rbi +154 -0
  33. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
  34. data/sorbet/rbi/gems/rake@12.3.3.rbi +3020 -0
  35. data/sorbet/rbi/gems/rbi@0.3.7.rbi +7115 -0
  36. data/sorbet/rbi/gems/rbs@3.9.5.rbi +6978 -0
  37. data/sorbet/rbi/gems/regexp_parser@2.11.2.rbi +9 -0
  38. data/sorbet/rbi/gems/rexml@3.3.5.rbi +5283 -0
  39. data/sorbet/rbi/gems/rspec-core@3.13.6.rbi +11004 -0
  40. data/sorbet/rbi/gems/rspec-expectations@3.13.5.rbi +8189 -0
  41. data/sorbet/rbi/gems/rspec-mocks@3.13.6.rbi +5350 -0
  42. data/sorbet/rbi/gems/rspec-support@3.13.6.rbi +1627 -0
  43. data/sorbet/rbi/gems/rspec@3.13.2.rbi +83 -0
  44. data/sorbet/rbi/gems/rubocop-ast@1.46.0.rbi +9 -0
  45. data/sorbet/rbi/gems/rubocop@1.35.1.rbi +9 -0
  46. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
  47. data/sorbet/rbi/gems/simple_scripting@0.14.0.rbi +9 -0
  48. data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
  49. data/sorbet/rbi/gems/strscan@3.1.0.rbi +9 -0
  50. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
  51. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  52. data/sorbet/rbi/gems/tty-color@0.6.0.rbi +9 -0
  53. data/sorbet/rbi/gems/tty-cursor@0.7.1.rbi +9 -0
  54. data/sorbet/rbi/gems/tty-prompt@0.23.1.rbi +9 -0
  55. data/sorbet/rbi/gems/tty-reader@0.9.0.rbi +9 -0
  56. data/sorbet/rbi/gems/tty-screen@0.8.2.rbi +9 -0
  57. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +9 -0
  58. data/sorbet/rbi/gems/vcr@6.1.0.rbi +2830 -0
  59. data/sorbet/rbi/gems/webmock@3.1.1.rbi +1660 -0
  60. data/sorbet/rbi/gems/wisper@2.0.1.rbi +9 -0
  61. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  62. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  63. data/sorbet/tapioca/config.yml +13 -0
  64. data/sorbet/tapioca/require.rb +4 -0
  65. metadata +92 -8
@@ -0,0 +1,1608 @@
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#690
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#695
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#2
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#615
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#329
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#329
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#300
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
+ # - Argument +source+ must be, or be convertible to, a \String:
727
+ # - If +source+ responds to instance method +to_str+,
728
+ # <tt>source.to_str</tt> becomes the source.
729
+ # - If +source+ responds to instance method +to_io+,
730
+ # <tt>source.to_io.read</tt> becomes the source.
731
+ # - If +source+ responds to instance method +read+,
732
+ # <tt>source.read</tt> becomes the source.
733
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
734
+ # - Option +allow_blank+ specifies a truthy value.
735
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
736
+ # - Otherwise, +source+ remains the source.
737
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
738
+ # It will be called recursively with each result (depth-first order).
739
+ # See details below.
740
+ # BEWARE: This method is meant to serialise data from trusted user input,
741
+ # like from your own database server or clients under your control, it could
742
+ # be dangerous to allow untrusted users to pass JSON sources into it.
743
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
744
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
745
+ # The default options can be changed via method JSON.load_default_options=.
746
+ #
747
+ # ---
748
+ #
749
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
750
+ # <tt>parse(source, opts)</tt>; see #parse.
751
+ #
752
+ # Source for following examples:
753
+ # source = <<-EOT
754
+ # {
755
+ # "name": "Dave",
756
+ # "age" :40,
757
+ # "hats": [
758
+ # "Cattleman's",
759
+ # "Panama",
760
+ # "Tophat"
761
+ # ]
762
+ # }
763
+ # EOT
764
+ #
765
+ # Load a \String:
766
+ # ruby = JSON.load(source)
767
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
768
+ #
769
+ # Load an \IO object:
770
+ # require 'stringio'
771
+ # object = JSON.load(StringIO.new(source))
772
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
773
+ #
774
+ # Load a \File object:
775
+ # path = 't.json'
776
+ # File.write(path, source)
777
+ # File.open(path) do |file|
778
+ # JSON.load(file)
779
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
780
+ #
781
+ # ---
782
+ #
783
+ # When +proc+ is given:
784
+ # - Modifies +source+ as above.
785
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
786
+ # - Recursively calls <tt>proc(result)</tt>.
787
+ # - Returns the final result.
788
+ #
789
+ # Example:
790
+ # require 'json'
791
+ #
792
+ # # Some classes for the example.
793
+ # class Base
794
+ # def initialize(attributes)
795
+ # @attributes = attributes
796
+ # end
797
+ # end
798
+ # class User < Base; end
799
+ # class Account < Base; end
800
+ # class Admin < Base; end
801
+ # # The JSON source.
802
+ # json = <<-EOF
803
+ # {
804
+ # "users": [
805
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
806
+ # {"type": "User", "username": "john", "email": "john@example.com"}
807
+ # ],
808
+ # "accounts": [
809
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
810
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
811
+ # ],
812
+ # "admins": {"type": "Admin", "password": "0wn3d"}
813
+ # }
814
+ # EOF
815
+ # # Deserializer method.
816
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
817
+ # type = obj.is_a?(Hash) && obj["type"]
818
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
819
+ # end
820
+ # # Call to JSON.load
821
+ # ruby = JSON.load(json, proc {|obj|
822
+ # case obj
823
+ # when Hash
824
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
825
+ # when Array
826
+ # obj.map! {|v| deserialize_obj v }
827
+ # end
828
+ # })
829
+ # pp ruby
830
+ # Output:
831
+ # {"users"=>
832
+ # [#<User:0x00000000064c4c98
833
+ # @attributes=
834
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
835
+ # #<User:0x00000000064c4bd0
836
+ # @attributes=
837
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
838
+ # "accounts"=>
839
+ # [{"account"=>
840
+ # #<Account:0x00000000064c4928
841
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
842
+ # {"account"=>
843
+ # #<Account:0x00000000064c4680
844
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
845
+ # "admins"=>
846
+ # #<Admin:0x00000000064c41f8
847
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
848
+ #
849
+ # source://json//lib/json/common.rb#541
850
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
851
+
852
+ # :call-seq:
853
+ # JSON.load_file(path, opts={}) -> object
854
+ #
855
+ # Calls:
856
+ # parse(File.read(path), opts)
857
+ #
858
+ # See method #parse.
859
+ #
860
+ # source://json//lib/json/common.rb#249
861
+ def load_file(filespec, opts = T.unsafe(nil)); end
862
+
863
+ # :call-seq:
864
+ # JSON.load_file!(path, opts = {})
865
+ #
866
+ # Calls:
867
+ # JSON.parse!(File.read(path, opts))
868
+ #
869
+ # See method #parse!
870
+ #
871
+ # source://json//lib/json/common.rb#260
872
+ def load_file!(filespec, opts = T.unsafe(nil)); end
873
+
874
+ # source://json//lib/json/common.rb#643
875
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
876
+
877
+ # :call-seq:
878
+ # JSON.parse(source, opts) -> object
879
+ #
880
+ # Returns the Ruby objects created by parsing the given +source+.
881
+ #
882
+ # Argument +source+ contains the \String to be parsed.
883
+ #
884
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
885
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
886
+ #
887
+ # ---
888
+ #
889
+ # When +source+ is a \JSON array, returns a Ruby \Array:
890
+ # source = '["foo", 1.0, true, false, null]'
891
+ # ruby = JSON.parse(source)
892
+ # ruby # => ["foo", 1.0, true, false, nil]
893
+ # ruby.class # => Array
894
+ #
895
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
896
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
897
+ # ruby = JSON.parse(source)
898
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
899
+ # ruby.class # => Hash
900
+ #
901
+ # For examples of parsing for all \JSON data types, see
902
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
903
+ #
904
+ # Parses nested JSON objects:
905
+ # source = <<-EOT
906
+ # {
907
+ # "name": "Dave",
908
+ # "age" :40,
909
+ # "hats": [
910
+ # "Cattleman's",
911
+ # "Panama",
912
+ # "Tophat"
913
+ # ]
914
+ # }
915
+ # EOT
916
+ # ruby = JSON.parse(source)
917
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
918
+ #
919
+ # ---
920
+ #
921
+ # Raises an exception if +source+ is not valid JSON:
922
+ # # Raises JSON::ParserError (783: unexpected token at ''):
923
+ # JSON.parse('')
924
+ #
925
+ # source://json//lib/json/common.rb#219
926
+ def parse(source, opts = T.unsafe(nil)); end
927
+
928
+ # :call-seq:
929
+ # JSON.parse!(source, opts) -> object
930
+ #
931
+ # Calls
932
+ # parse(source, opts)
933
+ # with +source+ and possibly modified +opts+.
934
+ #
935
+ # Differences from JSON.parse:
936
+ # - Option +max_nesting+, if not provided, defaults to +false+,
937
+ # which disables checking for nesting depth.
938
+ # - Option +allow_nan+, if not provided, defaults to +true+.
939
+ #
940
+ # source://json//lib/json/common.rb#234
941
+ def parse!(source, opts = T.unsafe(nil)); end
942
+
943
+ # :call-seq:
944
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
945
+ #
946
+ # Arguments +obj+ and +opts+ here are the same as
947
+ # arguments +obj+ and +opts+ in JSON.generate.
948
+ #
949
+ # Default options are:
950
+ # {
951
+ # indent: ' ', # Two spaces
952
+ # space: ' ', # One space
953
+ # array_nl: "\n", # Newline
954
+ # object_nl: "\n" # Newline
955
+ # }
956
+ #
957
+ # Example:
958
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
959
+ # json = JSON.pretty_generate(obj)
960
+ # puts json
961
+ # Output:
962
+ # {
963
+ # "foo": [
964
+ # "bar",
965
+ # "baz"
966
+ # ],
967
+ # "bat": {
968
+ # "bam": 0,
969
+ # "bad": 1
970
+ # }
971
+ # }
972
+ #
973
+ # source://json//lib/json/common.rb#374
974
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
975
+
976
+ # :stopdoc:
977
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
978
+ #
979
+ # source://json//lib/json/common.rb#374
980
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
981
+
982
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
983
+ #
984
+ # source://json//lib/json/common.rb#559
985
+ def recurse_proc(result, &proc); end
986
+
987
+ # source://json//lib/json/common.rb#541
988
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
989
+
990
+ # :stopdoc:
991
+ # I want to deprecate these later, so I'll first be silent about them, and
992
+ # later delete them.
993
+ #
994
+ # source://json//lib/json/common.rb#300
995
+ def unparse(obj, opts = T.unsafe(nil)); end
996
+
997
+ class << self
998
+ # :call-seq:
999
+ # JSON[object] -> new_array or new_string
1000
+ #
1001
+ # If +object+ is a \String,
1002
+ # calls JSON.parse with +object+ and +opts+ (see method #parse):
1003
+ # json = '[0, 1, null]'
1004
+ # JSON[json]# => [0, 1, nil]
1005
+ #
1006
+ # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
1007
+ # ruby = [0, 1, nil]
1008
+ # JSON[ruby] # => '[0,1,null]'
1009
+ #
1010
+ # source://json//lib/json/common.rb#22
1011
+ def [](object, opts = T.unsafe(nil)); end
1012
+
1013
+ # source://json//lib/json/common.rb#85
1014
+ def create_fast_state; end
1015
+
1016
+ # Returns the current create identifier.
1017
+ # See also JSON.create_id=.
1018
+ #
1019
+ # source://json//lib/json/common.rb#130
1020
+ def create_id; end
1021
+
1022
+ # Sets create identifier, which is used to decide if the _json_create_
1023
+ # hook of a class should be called; initial value is +json_class+:
1024
+ # JSON.create_id # => 'json_class'
1025
+ #
1026
+ # source://json//lib/json/common.rb#124
1027
+ def create_id=(new_value); end
1028
+
1029
+ # source://json//lib/json/common.rb#95
1030
+ def create_pretty_state; end
1031
+
1032
+ # Return the constant located at _path_. The format of _path_ has to be
1033
+ # either ::A::B::C or A::B::C. In any case, A has to be located at the top
1034
+ # level (absolute namespace path?). If there doesn't exist a constant at
1035
+ # the given path, an ArgumentError is raised.
1036
+ #
1037
+ # source://json//lib/json/common.rb#46
1038
+ def deep_const_get(path); end
1039
+
1040
+ # :call-seq:
1041
+ # JSON.dump(obj, io = nil, limit = nil)
1042
+ #
1043
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
1044
+ #
1045
+ # The default options can be changed via method JSON.dump_default_options.
1046
+ #
1047
+ # - Argument +io+, if given, should respond to method +write+;
1048
+ # the \JSON \String is written to +io+, and +io+ is returned.
1049
+ # If +io+ is not given, the \JSON \String is returned.
1050
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
1051
+ #
1052
+ # ---
1053
+ #
1054
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
1055
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
1056
+ # json = JSON.dump(obj)
1057
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
1058
+ #
1059
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
1060
+ # path = 't.json'
1061
+ # File.open(path, 'w') do |file|
1062
+ # JSON.dump(obj, file)
1063
+ # end # => #<File:t.json (closed)>
1064
+ # puts File.read(path)
1065
+ # Output:
1066
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1067
+ #
1068
+ # source://json//lib/json/common.rb#615
1069
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1070
+
1071
+ # Sets or returns the default options for the JSON.dump method.
1072
+ # Initially:
1073
+ # opts = JSON.dump_default_options
1074
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1075
+ #
1076
+ # source://json//lib/json/common.rb#580
1077
+ def dump_default_options; end
1078
+
1079
+ # Sets or returns the default options for the JSON.dump method.
1080
+ # Initially:
1081
+ # opts = JSON.dump_default_options
1082
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1083
+ #
1084
+ # source://json//lib/json/common.rb#580
1085
+ def dump_default_options=(_arg0); end
1086
+
1087
+ # :call-seq:
1088
+ # JSON.fast_generate(obj, opts) -> new_string
1089
+ #
1090
+ # Arguments +obj+ and +opts+ here are the same as
1091
+ # arguments +obj+ and +opts+ in JSON.generate.
1092
+ #
1093
+ # By default, generates \JSON data without checking
1094
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
1095
+ #
1096
+ # Raises an exception if +obj+ contains circular references:
1097
+ # a = []; b = []; a.push(b); b.push(a)
1098
+ # # Raises SystemStackError (stack level too deep):
1099
+ # JSON.fast_generate(a)
1100
+ #
1101
+ # source://json//lib/json/common.rb#329
1102
+ def fast_generate(obj, opts = T.unsafe(nil)); end
1103
+
1104
+ # :stopdoc:
1105
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1106
+ #
1107
+ # source://json//lib/json/common.rb#329
1108
+ def fast_unparse(obj, opts = T.unsafe(nil)); end
1109
+
1110
+ # :call-seq:
1111
+ # JSON.generate(obj, opts = nil) -> new_string
1112
+ #
1113
+ # Returns a \String containing the generated \JSON data.
1114
+ #
1115
+ # See also JSON.fast_generate, JSON.pretty_generate.
1116
+ #
1117
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
1118
+ #
1119
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
1120
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
1121
+ #
1122
+ # ---
1123
+ #
1124
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
1125
+ # obj = ["foo", 1.0, true, false, nil]
1126
+ # json = JSON.generate(obj)
1127
+ # json # => '["foo",1.0,true,false,null]'
1128
+ #
1129
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
1130
+ # obj = {foo: 0, bar: 's', baz: :bat}
1131
+ # json = JSON.generate(obj)
1132
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
1133
+ #
1134
+ # For examples of generating from other Ruby objects, see
1135
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
1136
+ #
1137
+ # ---
1138
+ #
1139
+ # Raises an exception if any formatting option is not a \String.
1140
+ #
1141
+ # Raises an exception if +obj+ contains circular references:
1142
+ # a = []; b = []; a.push(b); b.push(a)
1143
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
1144
+ # JSON.generate(a)
1145
+ #
1146
+ # source://json//lib/json/common.rb#300
1147
+ def generate(obj, opts = T.unsafe(nil)); end
1148
+
1149
+ # Returns the JSON generator module that is used by JSON. This is
1150
+ # either JSON::Ext::Generator or JSON::Pure::Generator:
1151
+ # JSON.generator # => JSON::Ext::Generator
1152
+ #
1153
+ # source://json//lib/json/common.rb#107
1154
+ def generator; end
1155
+
1156
+ # Set the module _generator_ to be used by JSON.
1157
+ #
1158
+ # source://json//lib/json/common.rb#62
1159
+ def generator=(generator); end
1160
+
1161
+ # Encodes string using String.encode.
1162
+ #
1163
+ # source://json//lib/json/common.rb#639
1164
+ def iconv(to, from, string); end
1165
+
1166
+ # :call-seq:
1167
+ # JSON.load(source, proc = nil, options = {}) -> object
1168
+ #
1169
+ # Returns the Ruby objects created by parsing the given +source+.
1170
+ #
1171
+ # - Argument +source+ must be, or be convertible to, a \String:
1172
+ # - If +source+ responds to instance method +to_str+,
1173
+ # <tt>source.to_str</tt> becomes the source.
1174
+ # - If +source+ responds to instance method +to_io+,
1175
+ # <tt>source.to_io.read</tt> becomes the source.
1176
+ # - If +source+ responds to instance method +read+,
1177
+ # <tt>source.read</tt> becomes the source.
1178
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1179
+ # - Option +allow_blank+ specifies a truthy value.
1180
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1181
+ # - Otherwise, +source+ remains the source.
1182
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1183
+ # It will be called recursively with each result (depth-first order).
1184
+ # See details below.
1185
+ # BEWARE: This method is meant to serialise data from trusted user input,
1186
+ # like from your own database server or clients under your control, it could
1187
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1188
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1189
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1190
+ # The default options can be changed via method JSON.load_default_options=.
1191
+ #
1192
+ # ---
1193
+ #
1194
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1195
+ # <tt>parse(source, opts)</tt>; see #parse.
1196
+ #
1197
+ # Source for following examples:
1198
+ # source = <<-EOT
1199
+ # {
1200
+ # "name": "Dave",
1201
+ # "age" :40,
1202
+ # "hats": [
1203
+ # "Cattleman's",
1204
+ # "Panama",
1205
+ # "Tophat"
1206
+ # ]
1207
+ # }
1208
+ # EOT
1209
+ #
1210
+ # Load a \String:
1211
+ # ruby = JSON.load(source)
1212
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1213
+ #
1214
+ # Load an \IO object:
1215
+ # require 'stringio'
1216
+ # object = JSON.load(StringIO.new(source))
1217
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1218
+ #
1219
+ # Load a \File object:
1220
+ # path = 't.json'
1221
+ # File.write(path, source)
1222
+ # File.open(path) do |file|
1223
+ # JSON.load(file)
1224
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1225
+ #
1226
+ # ---
1227
+ #
1228
+ # When +proc+ is given:
1229
+ # - Modifies +source+ as above.
1230
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1231
+ # - Recursively calls <tt>proc(result)</tt>.
1232
+ # - Returns the final result.
1233
+ #
1234
+ # Example:
1235
+ # require 'json'
1236
+ #
1237
+ # # Some classes for the example.
1238
+ # class Base
1239
+ # def initialize(attributes)
1240
+ # @attributes = attributes
1241
+ # end
1242
+ # end
1243
+ # class User < Base; end
1244
+ # class Account < Base; end
1245
+ # class Admin < Base; end
1246
+ # # The JSON source.
1247
+ # json = <<-EOF
1248
+ # {
1249
+ # "users": [
1250
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1251
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1252
+ # ],
1253
+ # "accounts": [
1254
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1255
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1256
+ # ],
1257
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1258
+ # }
1259
+ # EOF
1260
+ # # Deserializer method.
1261
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1262
+ # type = obj.is_a?(Hash) && obj["type"]
1263
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1264
+ # end
1265
+ # # Call to JSON.load
1266
+ # ruby = JSON.load(json, proc {|obj|
1267
+ # case obj
1268
+ # when Hash
1269
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1270
+ # when Array
1271
+ # obj.map! {|v| deserialize_obj v }
1272
+ # end
1273
+ # })
1274
+ # pp ruby
1275
+ # Output:
1276
+ # {"users"=>
1277
+ # [#<User:0x00000000064c4c98
1278
+ # @attributes=
1279
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1280
+ # #<User:0x00000000064c4bd0
1281
+ # @attributes=
1282
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1283
+ # "accounts"=>
1284
+ # [{"account"=>
1285
+ # #<Account:0x00000000064c4928
1286
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1287
+ # {"account"=>
1288
+ # #<Account:0x00000000064c4680
1289
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1290
+ # "admins"=>
1291
+ # #<Admin:0x00000000064c41f8
1292
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1293
+ #
1294
+ # source://json//lib/json/common.rb#541
1295
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1296
+
1297
+ # Sets or returns default options for the JSON.load method.
1298
+ # Initially:
1299
+ # opts = JSON.load_default_options
1300
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1301
+ #
1302
+ # source://json//lib/json/common.rb#404
1303
+ def load_default_options; end
1304
+
1305
+ # Sets or returns default options for the JSON.load method.
1306
+ # Initially:
1307
+ # opts = JSON.load_default_options
1308
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1309
+ #
1310
+ # source://json//lib/json/common.rb#404
1311
+ def load_default_options=(_arg0); end
1312
+
1313
+ # :call-seq:
1314
+ # JSON.load_file(path, opts={}) -> object
1315
+ #
1316
+ # Calls:
1317
+ # parse(File.read(path), opts)
1318
+ #
1319
+ # See method #parse.
1320
+ #
1321
+ # source://json//lib/json/common.rb#249
1322
+ def load_file(filespec, opts = T.unsafe(nil)); end
1323
+
1324
+ # :call-seq:
1325
+ # JSON.load_file!(path, opts = {})
1326
+ #
1327
+ # Calls:
1328
+ # JSON.parse!(File.read(path, opts))
1329
+ #
1330
+ # See method #parse!
1331
+ #
1332
+ # source://json//lib/json/common.rb#260
1333
+ def load_file!(filespec, opts = T.unsafe(nil)); end
1334
+
1335
+ # :call-seq:
1336
+ # JSON.parse(source, opts) -> object
1337
+ #
1338
+ # Returns the Ruby objects created by parsing the given +source+.
1339
+ #
1340
+ # Argument +source+ contains the \String to be parsed.
1341
+ #
1342
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
1343
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1344
+ #
1345
+ # ---
1346
+ #
1347
+ # When +source+ is a \JSON array, returns a Ruby \Array:
1348
+ # source = '["foo", 1.0, true, false, null]'
1349
+ # ruby = JSON.parse(source)
1350
+ # ruby # => ["foo", 1.0, true, false, nil]
1351
+ # ruby.class # => Array
1352
+ #
1353
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
1354
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
1355
+ # ruby = JSON.parse(source)
1356
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
1357
+ # ruby.class # => Hash
1358
+ #
1359
+ # For examples of parsing for all \JSON data types, see
1360
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
1361
+ #
1362
+ # Parses nested JSON objects:
1363
+ # source = <<-EOT
1364
+ # {
1365
+ # "name": "Dave",
1366
+ # "age" :40,
1367
+ # "hats": [
1368
+ # "Cattleman's",
1369
+ # "Panama",
1370
+ # "Tophat"
1371
+ # ]
1372
+ # }
1373
+ # EOT
1374
+ # ruby = JSON.parse(source)
1375
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1376
+ #
1377
+ # ---
1378
+ #
1379
+ # Raises an exception if +source+ is not valid JSON:
1380
+ # # Raises JSON::ParserError (783: unexpected token at ''):
1381
+ # JSON.parse('')
1382
+ #
1383
+ # source://json//lib/json/common.rb#219
1384
+ def parse(source, opts = T.unsafe(nil)); end
1385
+
1386
+ # :call-seq:
1387
+ # JSON.parse!(source, opts) -> object
1388
+ #
1389
+ # Calls
1390
+ # parse(source, opts)
1391
+ # with +source+ and possibly modified +opts+.
1392
+ #
1393
+ # Differences from JSON.parse:
1394
+ # - Option +max_nesting+, if not provided, defaults to +false+,
1395
+ # which disables checking for nesting depth.
1396
+ # - Option +allow_nan+, if not provided, defaults to +true+.
1397
+ #
1398
+ # source://json//lib/json/common.rb#234
1399
+ def parse!(source, opts = T.unsafe(nil)); end
1400
+
1401
+ # Returns the JSON parser class that is used by JSON. This is either
1402
+ # JSON::Ext::Parser or JSON::Pure::Parser:
1403
+ # JSON.parser # => JSON::Ext::Parser
1404
+ #
1405
+ # source://json//lib/json/common.rb#33
1406
+ def parser; end
1407
+
1408
+ # Set the JSON parser class _parser_ to be used by JSON.
1409
+ #
1410
+ # source://json//lib/json/common.rb#36
1411
+ def parser=(parser); end
1412
+
1413
+ # :call-seq:
1414
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
1415
+ #
1416
+ # Arguments +obj+ and +opts+ here are the same as
1417
+ # arguments +obj+ and +opts+ in JSON.generate.
1418
+ #
1419
+ # Default options are:
1420
+ # {
1421
+ # indent: ' ', # Two spaces
1422
+ # space: ' ', # One space
1423
+ # array_nl: "\n", # Newline
1424
+ # object_nl: "\n" # Newline
1425
+ # }
1426
+ #
1427
+ # Example:
1428
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
1429
+ # json = JSON.pretty_generate(obj)
1430
+ # puts json
1431
+ # Output:
1432
+ # {
1433
+ # "foo": [
1434
+ # "bar",
1435
+ # "baz"
1436
+ # ],
1437
+ # "bat": {
1438
+ # "bam": 0,
1439
+ # "bad": 1
1440
+ # }
1441
+ # }
1442
+ #
1443
+ # source://json//lib/json/common.rb#374
1444
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
1445
+
1446
+ # :stopdoc:
1447
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1448
+ #
1449
+ # source://json//lib/json/common.rb#374
1450
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
1451
+
1452
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1453
+ #
1454
+ # source://json//lib/json/common.rb#559
1455
+ def recurse_proc(result, &proc); end
1456
+
1457
+ # source://json//lib/json/common.rb#541
1458
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1459
+
1460
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1461
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1462
+ # JSON.state # => JSON::Ext::Generator::State
1463
+ #
1464
+ # source://json//lib/json/common.rb#112
1465
+ def state; end
1466
+
1467
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1468
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1469
+ # JSON.state # => JSON::Ext::Generator::State
1470
+ #
1471
+ # source://json//lib/json/common.rb#112
1472
+ def state=(_arg0); end
1473
+
1474
+ # :stopdoc:
1475
+ # I want to deprecate these later, so I'll first be silent about them, and
1476
+ # later delete them.
1477
+ #
1478
+ # source://json//lib/json/common.rb#300
1479
+ def unparse(obj, opts = T.unsafe(nil)); end
1480
+
1481
+ private
1482
+
1483
+ # source://json//lib/json/common.rb#643
1484
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
1485
+ end
1486
+ end
1487
+
1488
+ # source://json//lib/json/common.rb#118
1489
+ JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1490
+
1491
+ # source://json//lib/json/common.rb#115
1492
+ JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1493
+
1494
+ module JSON::Ext::Generator::GeneratorMethods::String
1495
+ mixes_in_class_methods ::JSON::Ext::Generator::GeneratorMethods::String::Extend
1496
+ end
1497
+
1498
+ # source://json//lib/json/generic_object.rb#9
1499
+ class JSON::GenericObject < ::OpenStruct
1500
+ # source://json//lib/json/generic_object.rb#67
1501
+ def as_json(*_arg0); end
1502
+
1503
+ # source://json//lib/json/generic_object.rb#51
1504
+ def to_hash; end
1505
+
1506
+ # source://json//lib/json/generic_object.rb#71
1507
+ def to_json(*a); end
1508
+
1509
+ # source://json//lib/json/generic_object.rb#63
1510
+ def |(other); end
1511
+
1512
+ class << self
1513
+ # source://json//lib/json/generic_object.rb#45
1514
+ def dump(obj, *args); end
1515
+
1516
+ # source://json//lib/json/generic_object.rb#25
1517
+ def from_hash(object); end
1518
+
1519
+ # Sets the attribute json_creatable
1520
+ #
1521
+ # @param value the value to set the attribute json_creatable to.
1522
+ #
1523
+ # source://json//lib/json/generic_object.rb#17
1524
+ def json_creatable=(_arg0); end
1525
+
1526
+ # @return [Boolean]
1527
+ #
1528
+ # source://json//lib/json/generic_object.rb#13
1529
+ def json_creatable?; end
1530
+
1531
+ # source://json//lib/json/generic_object.rb#19
1532
+ def json_create(data); end
1533
+
1534
+ # source://json//lib/json/generic_object.rb#40
1535
+ def load(source, proc = T.unsafe(nil), opts = T.unsafe(nil)); end
1536
+ end
1537
+ end
1538
+
1539
+ # The base exception for JSON errors.
1540
+ #
1541
+ # source://json//lib/json/common.rb#141
1542
+ class JSON::JSONError < ::StandardError
1543
+ class << self
1544
+ # source://json//lib/json/common.rb#142
1545
+ def wrap(exception); end
1546
+ end
1547
+ end
1548
+
1549
+ # source://json//lib/json/common.rb#7
1550
+ JSON::NOT_SET = T.let(T.unsafe(nil), Object)
1551
+
1552
+ # source://json//lib/json/common.rb#39
1553
+ JSON::Parser = JSON::Ext::Parser
1554
+
1555
+ # source://json//lib/json/common.rb#77
1556
+ JSON::State = JSON::Ext::Generator::State
1557
+
1558
+ # For backwards compatibility
1559
+ #
1560
+ # source://json//lib/json/common.rb#163
1561
+ JSON::UnparserError = JSON::GeneratorError
1562
+
1563
+ # source://json//lib/json/common.rb#653
1564
+ module Kernel
1565
+ private
1566
+
1567
+ # If _object_ is string-like, parse the string and return the parsed result as
1568
+ # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
1569
+ # structure object and return it.
1570
+ #
1571
+ # The _opts_ argument is passed through to generate/parse respectively. See
1572
+ # generate and parse for their documentation.
1573
+ #
1574
+ # source://json//lib/json/common.rb#680
1575
+ def JSON(object, *args); end
1576
+
1577
+ # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1578
+ # one line.
1579
+ #
1580
+ # source://json//lib/json/common.rb#658
1581
+ def j(*objs); end
1582
+
1583
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1584
+ # indentation and over many lines.
1585
+ #
1586
+ # source://json//lib/json/common.rb#667
1587
+ def jj(*objs); end
1588
+ end
1589
+
1590
+ class NilClass
1591
+ include ::JSON::Ext::Generator::GeneratorMethods::NilClass
1592
+ end
1593
+
1594
+ class Object < ::BasicObject
1595
+ include ::Kernel
1596
+ include ::PP::ObjectMixin
1597
+ include ::JSON::Ext::Generator::GeneratorMethods::Object
1598
+ end
1599
+
1600
+ class String
1601
+ include ::Comparable
1602
+ include ::JSON::Ext::Generator::GeneratorMethods::String
1603
+ extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
1604
+ end
1605
+
1606
+ class TrueClass
1607
+ include ::JSON::Ext::Generator::GeneratorMethods::TrueClass
1608
+ end