legal_entity 0.1.0.pre.beta0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +18 -0
  3. data/CHANGELOG.md +5 -0
  4. data/MIT-LICENSE +21 -0
  5. data/README.md +1 -0
  6. data/Rakefile +10 -0
  7. data/legal_entity.gemspec +45 -0
  8. data/lib/legal_entity/person.rb +7 -0
  9. data/lib/legal_entity/version.rb +6 -0
  10. data/lib/legal_entity.rb +9 -0
  11. data/sorbet/config +4 -0
  12. data/sorbet/rbi/annotations/.gitattributes +1 -0
  13. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  14. data/sorbet/rbi/annotations/activerecord.rbi +92 -0
  15. data/sorbet/rbi/annotations/activesupport.rbi +421 -0
  16. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  17. data/sorbet/rbi/gems/.gitattributes +1 -0
  18. data/sorbet/rbi/gems/activemodel@7.0.5.rbi +6022 -0
  19. data/sorbet/rbi/gems/activerecord@7.0.5.rbi +37827 -0
  20. data/sorbet/rbi/gems/activesupport@7.0.5.rbi +18125 -0
  21. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  22. data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +11590 -0
  23. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  24. data/sorbet/rbi/gems/i18n@1.14.1.rbi +2325 -0
  25. data/sorbet/rbi/gems/json@2.7.1.rbi +1561 -0
  26. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  27. data/sorbet/rbi/gems/minitest@5.22.2.rbi +1535 -0
  28. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  29. data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
  30. data/sorbet/rbi/gems/parser@3.3.0.5.rbi +5472 -0
  31. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  32. data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
  33. data/sorbet/rbi/gems/racc@1.7.3.rbi +161 -0
  34. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  35. data/sorbet/rbi/gems/rake@13.1.0.rbi +3132 -0
  36. data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
  37. data/sorbet/rbi/gems/regexp_parser@2.9.0.rbi +3771 -0
  38. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  39. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7141 -0
  40. data/sorbet/rbi/gems/rubocop-minitest@0.34.5.rbi +2576 -0
  41. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +328 -0
  42. data/sorbet/rbi/gems/rubocop-sorbet@0.7.4.rbi +1442 -0
  43. data/sorbet/rbi/gems/rubocop@1.60.2.rbi +57372 -0
  44. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  45. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  46. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
  47. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3508 -0
  48. data/sorbet/rbi/gems/thor@1.3.0.rbi +4345 -0
  49. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
  50. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  51. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  52. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  53. data/sorbet/tapioca/config.yml +13 -0
  54. data/sorbet/tapioca/require.rb +4 -0
  55. metadata +256 -0
@@ -0,0 +1,1561 @@
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
+ # Extends any Class to include _json_creatable?_ method.
8
+ #
9
+ # source://json//lib/json/common.rb#689
10
+ class Class < ::Module
11
+ # Returns true if this class can be used to create an instance
12
+ # from a serialised JSON string. The class has to implement a class
13
+ # method _json_create_ that expects a hash as first parameter. The hash
14
+ # should include the required data.
15
+ #
16
+ # @return [Boolean]
17
+ #
18
+ # source://json//lib/json/common.rb#694
19
+ def json_creatable?; end
20
+ end
21
+
22
+ # = JavaScript \Object Notation (\JSON)
23
+ #
24
+ # \JSON is a lightweight data-interchange format.
25
+ #
26
+ # A \JSON value is one of the following:
27
+ # - Double-quoted text: <tt>"foo"</tt>.
28
+ # - Number: +1+, +1.0+, +2.0e2+.
29
+ # - Boolean: +true+, +false+.
30
+ # - Null: +null+.
31
+ # - \Array: an ordered list of values, enclosed by square brackets:
32
+ # ["foo", 1, 1.0, 2.0e2, true, false, null]
33
+ #
34
+ # - \Object: a collection of name/value pairs, enclosed by curly braces;
35
+ # each name is double-quoted text;
36
+ # the values may be any \JSON values:
37
+ # {"a": "foo", "b": 1, "c": 1.0, "d": 2.0e2, "e": true, "f": false, "g": null}
38
+ #
39
+ # A \JSON array or object may contain nested arrays, objects, and scalars
40
+ # to any depth:
41
+ # {"foo": {"bar": 1, "baz": 2}, "bat": [0, 1, 2]}
42
+ # [{"foo": 0, "bar": 1}, ["baz", 2]]
43
+ #
44
+ # == Using \Module \JSON
45
+ #
46
+ # To make module \JSON available in your code, begin with:
47
+ # require 'json'
48
+ #
49
+ # All examples here assume that this has been done.
50
+ #
51
+ # === Parsing \JSON
52
+ #
53
+ # You can parse a \String containing \JSON data using
54
+ # either of two methods:
55
+ # - <tt>JSON.parse(source, opts)</tt>
56
+ # - <tt>JSON.parse!(source, opts)</tt>
57
+ #
58
+ # where
59
+ # - +source+ is a Ruby object.
60
+ # - +opts+ is a \Hash object containing options
61
+ # that control both input allowed and output formatting.
62
+ #
63
+ # The difference between the two methods
64
+ # is that JSON.parse! omits some checks
65
+ # and may not be safe for some +source+ data;
66
+ # use it only for data from trusted sources.
67
+ # Use the safer method JSON.parse for less trusted sources.
68
+ #
69
+ # ==== Parsing \JSON Arrays
70
+ #
71
+ # When +source+ is a \JSON array, JSON.parse by default returns a Ruby \Array:
72
+ # json = '["foo", 1, 1.0, 2.0e2, true, false, null]'
73
+ # ruby = JSON.parse(json)
74
+ # ruby # => ["foo", 1, 1.0, 200.0, true, false, nil]
75
+ # ruby.class # => Array
76
+ #
77
+ # The \JSON array may contain nested arrays, objects, and scalars
78
+ # to any depth:
79
+ # json = '[{"foo": 0, "bar": 1}, ["baz", 2]]'
80
+ # JSON.parse(json) # => [{"foo"=>0, "bar"=>1}, ["baz", 2]]
81
+ #
82
+ # ==== Parsing \JSON \Objects
83
+ #
84
+ # When the source is a \JSON object, JSON.parse by default returns a Ruby \Hash:
85
+ # json = '{"a": "foo", "b": 1, "c": 1.0, "d": 2.0e2, "e": true, "f": false, "g": null}'
86
+ # ruby = JSON.parse(json)
87
+ # ruby # => {"a"=>"foo", "b"=>1, "c"=>1.0, "d"=>200.0, "e"=>true, "f"=>false, "g"=>nil}
88
+ # ruby.class # => Hash
89
+ #
90
+ # The \JSON object may contain nested arrays, objects, and scalars
91
+ # to any depth:
92
+ # json = '{"foo": {"bar": 1, "baz": 2}, "bat": [0, 1, 2]}'
93
+ # JSON.parse(json) # => {"foo"=>{"bar"=>1, "baz"=>2}, "bat"=>[0, 1, 2]}
94
+ #
95
+ # ==== Parsing \JSON Scalars
96
+ #
97
+ # When the source is a \JSON scalar (not an array or object),
98
+ # JSON.parse returns a Ruby scalar.
99
+ #
100
+ # \String:
101
+ # ruby = JSON.parse('"foo"')
102
+ # ruby # => 'foo'
103
+ # ruby.class # => String
104
+ # \Integer:
105
+ # ruby = JSON.parse('1')
106
+ # ruby # => 1
107
+ # ruby.class # => Integer
108
+ # \Float:
109
+ # ruby = JSON.parse('1.0')
110
+ # ruby # => 1.0
111
+ # ruby.class # => Float
112
+ # ruby = JSON.parse('2.0e2')
113
+ # ruby # => 200
114
+ # ruby.class # => Float
115
+ # Boolean:
116
+ # ruby = JSON.parse('true')
117
+ # ruby # => true
118
+ # ruby.class # => TrueClass
119
+ # ruby = JSON.parse('false')
120
+ # ruby # => false
121
+ # ruby.class # => FalseClass
122
+ # Null:
123
+ # ruby = JSON.parse('null')
124
+ # ruby # => nil
125
+ # ruby.class # => NilClass
126
+ #
127
+ # ==== Parsing Options
128
+ #
129
+ # ====== Input Options
130
+ #
131
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth allowed;
132
+ # defaults to +100+; specify +false+ to disable depth checking.
133
+ #
134
+ # With the default, +false+:
135
+ # source = '[0, [1, [2, [3]]]]'
136
+ # ruby = JSON.parse(source)
137
+ # ruby # => [0, [1, [2, [3]]]]
138
+ # Too deep:
139
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
140
+ # JSON.parse(source, {max_nesting: 1})
141
+ # Bad value:
142
+ # # Raises TypeError (wrong argument type Symbol (expected Fixnum)):
143
+ # JSON.parse(source, {max_nesting: :foo})
144
+ #
145
+ # ---
146
+ #
147
+ # Option +allow_nan+ (boolean) specifies whether to allow
148
+ # NaN, Infinity, and MinusInfinity in +source+;
149
+ # defaults to +false+.
150
+ #
151
+ # With the default, +false+:
152
+ # # Raises JSON::ParserError (225: unexpected token at '[NaN]'):
153
+ # JSON.parse('[NaN]')
154
+ # # Raises JSON::ParserError (232: unexpected token at '[Infinity]'):
155
+ # JSON.parse('[Infinity]')
156
+ # # Raises JSON::ParserError (248: unexpected token at '[-Infinity]'):
157
+ # JSON.parse('[-Infinity]')
158
+ # Allow:
159
+ # source = '[NaN, Infinity, -Infinity]'
160
+ # ruby = JSON.parse(source, {allow_nan: true})
161
+ # ruby # => [NaN, Infinity, -Infinity]
162
+ #
163
+ # ====== Output Options
164
+ #
165
+ # Option +symbolize_names+ (boolean) specifies whether returned \Hash keys
166
+ # should be Symbols;
167
+ # defaults to +false+ (use Strings).
168
+ #
169
+ # With the default, +false+:
170
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
171
+ # ruby = JSON.parse(source)
172
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
173
+ # Use Symbols:
174
+ # ruby = JSON.parse(source, {symbolize_names: true})
175
+ # ruby # => {:a=>"foo", :b=>1.0, :c=>true, :d=>false, :e=>nil}
176
+ #
177
+ # ---
178
+ #
179
+ # Option +object_class+ (\Class) specifies the Ruby class to be used
180
+ # for each \JSON object;
181
+ # defaults to \Hash.
182
+ #
183
+ # With the default, \Hash:
184
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
185
+ # ruby = JSON.parse(source)
186
+ # ruby.class # => Hash
187
+ # Use class \OpenStruct:
188
+ # ruby = JSON.parse(source, {object_class: OpenStruct})
189
+ # ruby # => #<OpenStruct a="foo", b=1.0, c=true, d=false, e=nil>
190
+ #
191
+ # ---
192
+ #
193
+ # Option +array_class+ (\Class) specifies the Ruby class to be used
194
+ # for each \JSON array;
195
+ # defaults to \Array.
196
+ #
197
+ # With the default, \Array:
198
+ # source = '["foo", 1.0, true, false, null]'
199
+ # ruby = JSON.parse(source)
200
+ # ruby.class # => Array
201
+ # Use class \Set:
202
+ # ruby = JSON.parse(source, {array_class: Set})
203
+ # ruby # => #<Set: {"foo", 1.0, true, false, nil}>
204
+ #
205
+ # ---
206
+ #
207
+ # Option +create_additions+ (boolean) specifies whether to use \JSON additions in parsing.
208
+ # See {\JSON Additions}[#module-JSON-label-JSON+Additions].
209
+ #
210
+ # === Generating \JSON
211
+ #
212
+ # To generate a Ruby \String containing \JSON data,
213
+ # use method <tt>JSON.generate(source, opts)</tt>, where
214
+ # - +source+ is a Ruby object.
215
+ # - +opts+ is a \Hash object containing options
216
+ # that control both input allowed and output formatting.
217
+ #
218
+ # ==== Generating \JSON from Arrays
219
+ #
220
+ # When the source is a Ruby \Array, JSON.generate returns
221
+ # a \String containing a \JSON array:
222
+ # ruby = [0, 's', :foo]
223
+ # json = JSON.generate(ruby)
224
+ # json # => '[0,"s","foo"]'
225
+ #
226
+ # The Ruby \Array array may contain nested arrays, hashes, and scalars
227
+ # to any depth:
228
+ # ruby = [0, [1, 2], {foo: 3, bar: 4}]
229
+ # json = JSON.generate(ruby)
230
+ # json # => '[0,[1,2],{"foo":3,"bar":4}]'
231
+ #
232
+ # ==== Generating \JSON from Hashes
233
+ #
234
+ # When the source is a Ruby \Hash, JSON.generate returns
235
+ # a \String containing a \JSON object:
236
+ # ruby = {foo: 0, bar: 's', baz: :bat}
237
+ # json = JSON.generate(ruby)
238
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
239
+ #
240
+ # The Ruby \Hash array may contain nested arrays, hashes, and scalars
241
+ # to any depth:
242
+ # ruby = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
243
+ # json = JSON.generate(ruby)
244
+ # json # => '{"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}'
245
+ #
246
+ # ==== Generating \JSON from Other Objects
247
+ #
248
+ # When the source is neither an \Array nor a \Hash,
249
+ # the generated \JSON data depends on the class of the source.
250
+ #
251
+ # When the source is a Ruby \Integer or \Float, JSON.generate returns
252
+ # a \String containing a \JSON number:
253
+ # JSON.generate(42) # => '42'
254
+ # JSON.generate(0.42) # => '0.42'
255
+ #
256
+ # When the source is a Ruby \String, JSON.generate returns
257
+ # a \String containing a \JSON string (with double-quotes):
258
+ # JSON.generate('A string') # => '"A string"'
259
+ #
260
+ # When the source is +true+, +false+ or +nil+, JSON.generate returns
261
+ # a \String containing the corresponding \JSON token:
262
+ # JSON.generate(true) # => 'true'
263
+ # JSON.generate(false) # => 'false'
264
+ # JSON.generate(nil) # => 'null'
265
+ #
266
+ # When the source is none of the above, JSON.generate returns
267
+ # a \String containing a \JSON string representation of the source:
268
+ # JSON.generate(:foo) # => '"foo"'
269
+ # JSON.generate(Complex(0, 0)) # => '"0+0i"'
270
+ # JSON.generate(Dir.new('.')) # => '"#<Dir>"'
271
+ #
272
+ # ==== Generating Options
273
+ #
274
+ # ====== Input Options
275
+ #
276
+ # Option +allow_nan+ (boolean) specifies whether
277
+ # +NaN+, +Infinity+, and <tt>-Infinity</tt> may be generated;
278
+ # defaults to +false+.
279
+ #
280
+ # With the default, +false+:
281
+ # # Raises JSON::GeneratorError (920: NaN not allowed in JSON):
282
+ # JSON.generate(JSON::NaN)
283
+ # # Raises JSON::GeneratorError (917: Infinity not allowed in JSON):
284
+ # JSON.generate(JSON::Infinity)
285
+ # # Raises JSON::GeneratorError (917: -Infinity not allowed in JSON):
286
+ # JSON.generate(JSON::MinusInfinity)
287
+ #
288
+ # Allow:
289
+ # ruby = [Float::NaN, Float::Infinity, Float::MinusInfinity]
290
+ # JSON.generate(ruby, allow_nan: true) # => '[NaN,Infinity,-Infinity]'
291
+ #
292
+ # ---
293
+ #
294
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth
295
+ # in +obj+; defaults to +100+.
296
+ #
297
+ # With the default, +100+:
298
+ # obj = [[[[[[0]]]]]]
299
+ # JSON.generate(obj) # => '[[[[[[0]]]]]]'
300
+ #
301
+ # Too deep:
302
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
303
+ # JSON.generate(obj, max_nesting: 2)
304
+ #
305
+ # ====== Escaping Options
306
+ #
307
+ # Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt>
308
+ # and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script
309
+ # tags.
310
+ #
311
+ # Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range
312
+ # should be escaped.
313
+ #
314
+ # ====== Output Options
315
+ #
316
+ # The default formatting options generate the most compact
317
+ # \JSON data, all on one line and with no whitespace.
318
+ #
319
+ # You can use these formatting options to generate
320
+ # \JSON data in a more open format, using whitespace.
321
+ # See also JSON.pretty_generate.
322
+ #
323
+ # - Option +array_nl+ (\String) specifies a string (usually a newline)
324
+ # to be inserted after each \JSON array; defaults to the empty \String, <tt>''</tt>.
325
+ # - Option +object_nl+ (\String) specifies a string (usually a newline)
326
+ # to be inserted after each \JSON object; defaults to the empty \String, <tt>''</tt>.
327
+ # - Option +indent+ (\String) specifies the string (usually spaces) to be
328
+ # used for indentation; defaults to the empty \String, <tt>''</tt>;
329
+ # defaults to the empty \String, <tt>''</tt>;
330
+ # has no effect unless options +array_nl+ or +object_nl+ specify newlines.
331
+ # - Option +space+ (\String) specifies a string (usually a space) to be
332
+ # inserted after the colon in each \JSON object's pair;
333
+ # defaults to the empty \String, <tt>''</tt>.
334
+ # - Option +space_before+ (\String) specifies a string (usually a space) to be
335
+ # inserted before the colon in each \JSON object's pair;
336
+ # defaults to the empty \String, <tt>''</tt>.
337
+ #
338
+ # In this example, +obj+ is used first to generate the shortest
339
+ # \JSON data (no whitespace), then again with all formatting options
340
+ # specified:
341
+ #
342
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
343
+ # json = JSON.generate(obj)
344
+ # puts 'Compact:', json
345
+ # opts = {
346
+ # array_nl: "\n",
347
+ # object_nl: "\n",
348
+ # indent: ' ',
349
+ # space_before: ' ',
350
+ # space: ' '
351
+ # }
352
+ # puts 'Open:', JSON.generate(obj, opts)
353
+ #
354
+ # Output:
355
+ # Compact:
356
+ # {"foo":["bar","baz"],"bat":{"bam":0,"bad":1}}
357
+ # Open:
358
+ # {
359
+ # "foo" : [
360
+ # "bar",
361
+ # "baz"
362
+ # ],
363
+ # "bat" : {
364
+ # "bam" : 0,
365
+ # "bad" : 1
366
+ # }
367
+ # }
368
+ #
369
+ # == \JSON Additions
370
+ #
371
+ # When you "round trip" a non-\String object from Ruby to \JSON and back,
372
+ # you have a new \String, instead of the object you began with:
373
+ # ruby0 = Range.new(0, 2)
374
+ # json = JSON.generate(ruby0)
375
+ # json # => '0..2"'
376
+ # ruby1 = JSON.parse(json)
377
+ # ruby1 # => '0..2'
378
+ # ruby1.class # => String
379
+ #
380
+ # You can use \JSON _additions_ to preserve the original object.
381
+ # The addition is an extension of a ruby class, so that:
382
+ # - \JSON.generate stores more information in the \JSON string.
383
+ # - \JSON.parse, called with option +create_additions+,
384
+ # uses that information to create a proper Ruby object.
385
+ #
386
+ # This example shows a \Range being generated into \JSON
387
+ # and parsed back into Ruby, both without and with
388
+ # the addition for \Range:
389
+ # ruby = Range.new(0, 2)
390
+ # # This passage does not use the addition for Range.
391
+ # json0 = JSON.generate(ruby)
392
+ # ruby0 = JSON.parse(json0)
393
+ # # This passage uses the addition for Range.
394
+ # require 'json/add/range'
395
+ # json1 = JSON.generate(ruby)
396
+ # ruby1 = JSON.parse(json1, create_additions: true)
397
+ # # Make a nice display.
398
+ # display = <<EOT
399
+ # Generated JSON:
400
+ # Without addition: #{json0} (#{json0.class})
401
+ # With addition: #{json1} (#{json1.class})
402
+ # Parsed JSON:
403
+ # Without addition: #{ruby0.inspect} (#{ruby0.class})
404
+ # With addition: #{ruby1.inspect} (#{ruby1.class})
405
+ # EOT
406
+ # puts display
407
+ #
408
+ # This output shows the different results:
409
+ # Generated JSON:
410
+ # Without addition: "0..2" (String)
411
+ # With addition: {"json_class":"Range","a":[0,2,false]} (String)
412
+ # Parsed JSON:
413
+ # Without addition: "0..2" (String)
414
+ # With addition: 0..2 (Range)
415
+ #
416
+ # The \JSON module includes additions for certain classes.
417
+ # You can also craft custom additions.
418
+ # See {Custom \JSON Additions}[#module-JSON-label-Custom+JSON+Additions].
419
+ #
420
+ # === Built-in Additions
421
+ #
422
+ # The \JSON module includes additions for certain classes.
423
+ # To use an addition, +require+ its source:
424
+ # - BigDecimal: <tt>require 'json/add/bigdecimal'</tt>
425
+ # - Complex: <tt>require 'json/add/complex'</tt>
426
+ # - Date: <tt>require 'json/add/date'</tt>
427
+ # - DateTime: <tt>require 'json/add/date_time'</tt>
428
+ # - Exception: <tt>require 'json/add/exception'</tt>
429
+ # - OpenStruct: <tt>require 'json/add/ostruct'</tt>
430
+ # - Range: <tt>require 'json/add/range'</tt>
431
+ # - Rational: <tt>require 'json/add/rational'</tt>
432
+ # - Regexp: <tt>require 'json/add/regexp'</tt>
433
+ # - Set: <tt>require 'json/add/set'</tt>
434
+ # - Struct: <tt>require 'json/add/struct'</tt>
435
+ # - Symbol: <tt>require 'json/add/symbol'</tt>
436
+ # - Time: <tt>require 'json/add/time'</tt>
437
+ #
438
+ # To reduce punctuation clutter, the examples below
439
+ # show the generated \JSON via +puts+, rather than the usual +inspect+,
440
+ #
441
+ # \BigDecimal:
442
+ # require 'json/add/bigdecimal'
443
+ # ruby0 = BigDecimal(0) # 0.0
444
+ # json = JSON.generate(ruby0) # {"json_class":"BigDecimal","b":"27:0.0"}
445
+ # ruby1 = JSON.parse(json, create_additions: true) # 0.0
446
+ # ruby1.class # => BigDecimal
447
+ #
448
+ # \Complex:
449
+ # require 'json/add/complex'
450
+ # ruby0 = Complex(1+0i) # 1+0i
451
+ # json = JSON.generate(ruby0) # {"json_class":"Complex","r":1,"i":0}
452
+ # ruby1 = JSON.parse(json, create_additions: true) # 1+0i
453
+ # ruby1.class # Complex
454
+ #
455
+ # \Date:
456
+ # require 'json/add/date'
457
+ # ruby0 = Date.today # 2020-05-02
458
+ # json = JSON.generate(ruby0) # {"json_class":"Date","y":2020,"m":5,"d":2,"sg":2299161.0}
459
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02
460
+ # ruby1.class # Date
461
+ #
462
+ # \DateTime:
463
+ # require 'json/add/date_time'
464
+ # ruby0 = DateTime.now # 2020-05-02T10:38:13-05:00
465
+ # 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}
466
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02T10:38:13-05:00
467
+ # ruby1.class # DateTime
468
+ #
469
+ # \Exception (and its subclasses including \RuntimeError):
470
+ # require 'json/add/exception'
471
+ # ruby0 = Exception.new('A message') # A message
472
+ # json = JSON.generate(ruby0) # {"json_class":"Exception","m":"A message","b":null}
473
+ # ruby1 = JSON.parse(json, create_additions: true) # A message
474
+ # ruby1.class # Exception
475
+ # ruby0 = RuntimeError.new('Another message') # Another message
476
+ # json = JSON.generate(ruby0) # {"json_class":"RuntimeError","m":"Another message","b":null}
477
+ # ruby1 = JSON.parse(json, create_additions: true) # Another message
478
+ # ruby1.class # RuntimeError
479
+ #
480
+ # \OpenStruct:
481
+ # require 'json/add/ostruct'
482
+ # ruby0 = OpenStruct.new(name: 'Matz', language: 'Ruby') # #<OpenStruct name="Matz", language="Ruby">
483
+ # json = JSON.generate(ruby0) # {"json_class":"OpenStruct","t":{"name":"Matz","language":"Ruby"}}
484
+ # ruby1 = JSON.parse(json, create_additions: true) # #<OpenStruct name="Matz", language="Ruby">
485
+ # ruby1.class # OpenStruct
486
+ #
487
+ # \Range:
488
+ # require 'json/add/range'
489
+ # ruby0 = Range.new(0, 2) # 0..2
490
+ # json = JSON.generate(ruby0) # {"json_class":"Range","a":[0,2,false]}
491
+ # ruby1 = JSON.parse(json, create_additions: true) # 0..2
492
+ # ruby1.class # Range
493
+ #
494
+ # \Rational:
495
+ # require 'json/add/rational'
496
+ # ruby0 = Rational(1, 3) # 1/3
497
+ # json = JSON.generate(ruby0) # {"json_class":"Rational","n":1,"d":3}
498
+ # ruby1 = JSON.parse(json, create_additions: true) # 1/3
499
+ # ruby1.class # Rational
500
+ #
501
+ # \Regexp:
502
+ # require 'json/add/regexp'
503
+ # ruby0 = Regexp.new('foo') # (?-mix:foo)
504
+ # json = JSON.generate(ruby0) # {"json_class":"Regexp","o":0,"s":"foo"}
505
+ # ruby1 = JSON.parse(json, create_additions: true) # (?-mix:foo)
506
+ # ruby1.class # Regexp
507
+ #
508
+ # \Set:
509
+ # require 'json/add/set'
510
+ # ruby0 = Set.new([0, 1, 2]) # #<Set: {0, 1, 2}>
511
+ # json = JSON.generate(ruby0) # {"json_class":"Set","a":[0,1,2]}
512
+ # ruby1 = JSON.parse(json, create_additions: true) # #<Set: {0, 1, 2}>
513
+ # ruby1.class # Set
514
+ #
515
+ # \Struct:
516
+ # require 'json/add/struct'
517
+ # Customer = Struct.new(:name, :address) # Customer
518
+ # ruby0 = Customer.new("Dave", "123 Main") # #<struct Customer name="Dave", address="123 Main">
519
+ # json = JSON.generate(ruby0) # {"json_class":"Customer","v":["Dave","123 Main"]}
520
+ # ruby1 = JSON.parse(json, create_additions: true) # #<struct Customer name="Dave", address="123 Main">
521
+ # ruby1.class # Customer
522
+ #
523
+ # \Symbol:
524
+ # require 'json/add/symbol'
525
+ # ruby0 = :foo # foo
526
+ # json = JSON.generate(ruby0) # {"json_class":"Symbol","s":"foo"}
527
+ # ruby1 = JSON.parse(json, create_additions: true) # foo
528
+ # ruby1.class # Symbol
529
+ #
530
+ # \Time:
531
+ # require 'json/add/time'
532
+ # ruby0 = Time.now # 2020-05-02 11:28:26 -0500
533
+ # json = JSON.generate(ruby0) # {"json_class":"Time","s":1588436906,"n":840560000}
534
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02 11:28:26 -0500
535
+ # ruby1.class # Time
536
+ #
537
+ #
538
+ # === Custom \JSON Additions
539
+ #
540
+ # In addition to the \JSON additions provided,
541
+ # you can craft \JSON additions of your own,
542
+ # either for Ruby built-in classes or for user-defined classes.
543
+ #
544
+ # Here's a user-defined class +Foo+:
545
+ # class Foo
546
+ # attr_accessor :bar, :baz
547
+ # def initialize(bar, baz)
548
+ # self.bar = bar
549
+ # self.baz = baz
550
+ # end
551
+ # end
552
+ #
553
+ # Here's the \JSON addition for it:
554
+ # # Extend class Foo with JSON addition.
555
+ # class Foo
556
+ # # Serialize Foo object with its class name and arguments
557
+ # def to_json(*args)
558
+ # {
559
+ # JSON.create_id => self.class.name,
560
+ # 'a' => [ bar, baz ]
561
+ # }.to_json(*args)
562
+ # end
563
+ # # Deserialize JSON string by constructing new Foo object with arguments.
564
+ # def self.json_create(object)
565
+ # new(*object['a'])
566
+ # end
567
+ # end
568
+ #
569
+ # Demonstration:
570
+ # require 'json'
571
+ # # This Foo object has no custom addition.
572
+ # foo0 = Foo.new(0, 1)
573
+ # json0 = JSON.generate(foo0)
574
+ # obj0 = JSON.parse(json0)
575
+ # # Lood the custom addition.
576
+ # require_relative 'foo_addition'
577
+ # # This foo has the custom addition.
578
+ # foo1 = Foo.new(0, 1)
579
+ # json1 = JSON.generate(foo1)
580
+ # obj1 = JSON.parse(json1, create_additions: true)
581
+ # # Make a nice display.
582
+ # display = <<EOT
583
+ # Generated JSON:
584
+ # Without custom addition: #{json0} (#{json0.class})
585
+ # With custom addition: #{json1} (#{json1.class})
586
+ # Parsed JSON:
587
+ # Without custom addition: #{obj0.inspect} (#{obj0.class})
588
+ # With custom addition: #{obj1.inspect} (#{obj1.class})
589
+ # EOT
590
+ # puts display
591
+ #
592
+ # Output:
593
+ #
594
+ # Generated JSON:
595
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
596
+ # With custom addition: {"json_class":"Foo","a":[0,1]} (String)
597
+ # Parsed JSON:
598
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
599
+ # With custom addition: #<Foo:0x0000000006473bb8 @bar=0, @baz=1> (Foo)
600
+ #
601
+ # source://json//lib/json/version.rb#2
602
+ module JSON
603
+ private
604
+
605
+ # :call-seq:
606
+ # JSON.dump(obj, io = nil, limit = nil)
607
+ #
608
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
609
+ #
610
+ # The default options can be changed via method JSON.dump_default_options.
611
+ #
612
+ # - Argument +io+, if given, should respond to method +write+;
613
+ # the \JSON \String is written to +io+, and +io+ is returned.
614
+ # If +io+ is not given, the \JSON \String is returned.
615
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
616
+ #
617
+ # ---
618
+ #
619
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
620
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
621
+ # json = JSON.dump(obj)
622
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
623
+ #
624
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
625
+ # path = 't.json'
626
+ # File.open(path, 'w') do |file|
627
+ # JSON.dump(obj, file)
628
+ # end # => #<File:t.json (closed)>
629
+ # puts File.read(path)
630
+ # Output:
631
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
632
+ #
633
+ # source://json//lib/json/common.rb#614
634
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
635
+
636
+ # :call-seq:
637
+ # JSON.fast_generate(obj, opts) -> new_string
638
+ #
639
+ # Arguments +obj+ and +opts+ here are the same as
640
+ # arguments +obj+ and +opts+ in JSON.generate.
641
+ #
642
+ # By default, generates \JSON data without checking
643
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
644
+ #
645
+ # Raises an exception if +obj+ contains circular references:
646
+ # a = []; b = []; a.push(b); b.push(a)
647
+ # # Raises SystemStackError (stack level too deep):
648
+ # JSON.fast_generate(a)
649
+ #
650
+ # source://json//lib/json/common.rb#328
651
+ def fast_generate(obj, opts = T.unsafe(nil)); end
652
+
653
+ # :stopdoc:
654
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
655
+ #
656
+ # source://json//lib/json/common.rb#328
657
+ def fast_unparse(obj, opts = T.unsafe(nil)); end
658
+
659
+ # :call-seq:
660
+ # JSON.generate(obj, opts = nil) -> new_string
661
+ #
662
+ # Returns a \String containing the generated \JSON data.
663
+ #
664
+ # See also JSON.fast_generate, JSON.pretty_generate.
665
+ #
666
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
667
+ #
668
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
669
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
670
+ #
671
+ # ---
672
+ #
673
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
674
+ # obj = ["foo", 1.0, true, false, nil]
675
+ # json = JSON.generate(obj)
676
+ # json # => '["foo",1.0,true,false,null]'
677
+ #
678
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
679
+ # obj = {foo: 0, bar: 's', baz: :bat}
680
+ # json = JSON.generate(obj)
681
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
682
+ #
683
+ # For examples of generating from other Ruby objects, see
684
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
685
+ #
686
+ # ---
687
+ #
688
+ # Raises an exception if any formatting option is not a \String.
689
+ #
690
+ # Raises an exception if +obj+ contains circular references:
691
+ # a = []; b = []; a.push(b); b.push(a)
692
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
693
+ # JSON.generate(a)
694
+ #
695
+ # source://json//lib/json/common.rb#299
696
+ def generate(obj, opts = T.unsafe(nil)); end
697
+
698
+ # :call-seq:
699
+ # JSON.load(source, proc = nil, options = {}) -> object
700
+ #
701
+ # Returns the Ruby objects created by parsing the given +source+.
702
+ #
703
+ # - Argument +source+ must be, or be convertible to, a \String:
704
+ # - If +source+ responds to instance method +to_str+,
705
+ # <tt>source.to_str</tt> becomes the source.
706
+ # - If +source+ responds to instance method +to_io+,
707
+ # <tt>source.to_io.read</tt> becomes the source.
708
+ # - If +source+ responds to instance method +read+,
709
+ # <tt>source.read</tt> becomes the source.
710
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
711
+ # - Option +allow_blank+ specifies a truthy value.
712
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
713
+ # - Otherwise, +source+ remains the source.
714
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
715
+ # It will be called recursively with each result (depth-first order).
716
+ # See details below.
717
+ # BEWARE: This method is meant to serialise data from trusted user input,
718
+ # like from your own database server or clients under your control, it could
719
+ # be dangerous to allow untrusted users to pass JSON sources into it.
720
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
721
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
722
+ # The default options can be changed via method JSON.load_default_options=.
723
+ #
724
+ # ---
725
+ #
726
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
727
+ # <tt>parse(source, opts)</tt>; see #parse.
728
+ #
729
+ # Source for following examples:
730
+ # source = <<-EOT
731
+ # {
732
+ # "name": "Dave",
733
+ # "age" :40,
734
+ # "hats": [
735
+ # "Cattleman's",
736
+ # "Panama",
737
+ # "Tophat"
738
+ # ]
739
+ # }
740
+ # EOT
741
+ #
742
+ # Load a \String:
743
+ # ruby = JSON.load(source)
744
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
745
+ #
746
+ # Load an \IO object:
747
+ # require 'stringio'
748
+ # object = JSON.load(StringIO.new(source))
749
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
750
+ #
751
+ # Load a \File object:
752
+ # path = 't.json'
753
+ # File.write(path, source)
754
+ # File.open(path) do |file|
755
+ # JSON.load(file)
756
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
757
+ #
758
+ # ---
759
+ #
760
+ # When +proc+ is given:
761
+ # - Modifies +source+ as above.
762
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
763
+ # - Recursively calls <tt>proc(result)</tt>.
764
+ # - Returns the final result.
765
+ #
766
+ # Example:
767
+ # require 'json'
768
+ #
769
+ # # Some classes for the example.
770
+ # class Base
771
+ # def initialize(attributes)
772
+ # @attributes = attributes
773
+ # end
774
+ # end
775
+ # class User < Base; end
776
+ # class Account < Base; end
777
+ # class Admin < Base; end
778
+ # # The JSON source.
779
+ # json = <<-EOF
780
+ # {
781
+ # "users": [
782
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
783
+ # {"type": "User", "username": "john", "email": "john@example.com"}
784
+ # ],
785
+ # "accounts": [
786
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
787
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
788
+ # ],
789
+ # "admins": {"type": "Admin", "password": "0wn3d"}
790
+ # }
791
+ # EOF
792
+ # # Deserializer method.
793
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
794
+ # type = obj.is_a?(Hash) && obj["type"]
795
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
796
+ # end
797
+ # # Call to JSON.load
798
+ # ruby = JSON.load(json, proc {|obj|
799
+ # case obj
800
+ # when Hash
801
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
802
+ # when Array
803
+ # obj.map! {|v| deserialize_obj v }
804
+ # end
805
+ # })
806
+ # pp ruby
807
+ # Output:
808
+ # {"users"=>
809
+ # [#<User:0x00000000064c4c98
810
+ # @attributes=
811
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
812
+ # #<User:0x00000000064c4bd0
813
+ # @attributes=
814
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
815
+ # "accounts"=>
816
+ # [{"account"=>
817
+ # #<Account:0x00000000064c4928
818
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
819
+ # {"account"=>
820
+ # #<Account:0x00000000064c4680
821
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
822
+ # "admins"=>
823
+ # #<Admin:0x00000000064c41f8
824
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
825
+ #
826
+ # source://json//lib/json/common.rb#540
827
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
828
+
829
+ # :call-seq:
830
+ # JSON.load_file(path, opts={}) -> object
831
+ #
832
+ # Calls:
833
+ # parse(File.read(path), opts)
834
+ #
835
+ # See method #parse.
836
+ #
837
+ # source://json//lib/json/common.rb#248
838
+ def load_file(filespec, opts = T.unsafe(nil)); end
839
+
840
+ # :call-seq:
841
+ # JSON.load_file!(path, opts = {})
842
+ #
843
+ # Calls:
844
+ # JSON.parse!(File.read(path, opts))
845
+ #
846
+ # See method #parse!
847
+ #
848
+ # source://json//lib/json/common.rb#259
849
+ def load_file!(filespec, opts = T.unsafe(nil)); end
850
+
851
+ # source://json//lib/json/common.rb#642
852
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
853
+
854
+ # :call-seq:
855
+ # JSON.parse(source, opts) -> object
856
+ #
857
+ # Returns the Ruby objects created by parsing the given +source+.
858
+ #
859
+ # Argument +source+ contains the \String to be parsed.
860
+ #
861
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
862
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
863
+ #
864
+ # ---
865
+ #
866
+ # When +source+ is a \JSON array, returns a Ruby \Array:
867
+ # source = '["foo", 1.0, true, false, null]'
868
+ # ruby = JSON.parse(source)
869
+ # ruby # => ["foo", 1.0, true, false, nil]
870
+ # ruby.class # => Array
871
+ #
872
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
873
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
874
+ # ruby = JSON.parse(source)
875
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
876
+ # ruby.class # => Hash
877
+ #
878
+ # For examples of parsing for all \JSON data types, see
879
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
880
+ #
881
+ # Parses nested JSON objects:
882
+ # source = <<-EOT
883
+ # {
884
+ # "name": "Dave",
885
+ # "age" :40,
886
+ # "hats": [
887
+ # "Cattleman's",
888
+ # "Panama",
889
+ # "Tophat"
890
+ # ]
891
+ # }
892
+ # EOT
893
+ # ruby = JSON.parse(source)
894
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
895
+ #
896
+ # ---
897
+ #
898
+ # Raises an exception if +source+ is not valid JSON:
899
+ # # Raises JSON::ParserError (783: unexpected token at ''):
900
+ # JSON.parse('')
901
+ #
902
+ # source://json//lib/json/common.rb#218
903
+ def parse(source, opts = T.unsafe(nil)); end
904
+
905
+ # :call-seq:
906
+ # JSON.parse!(source, opts) -> object
907
+ #
908
+ # Calls
909
+ # parse(source, opts)
910
+ # with +source+ and possibly modified +opts+.
911
+ #
912
+ # Differences from JSON.parse:
913
+ # - Option +max_nesting+, if not provided, defaults to +false+,
914
+ # which disables checking for nesting depth.
915
+ # - Option +allow_nan+, if not provided, defaults to +true+.
916
+ #
917
+ # source://json//lib/json/common.rb#233
918
+ def parse!(source, opts = T.unsafe(nil)); end
919
+
920
+ # :call-seq:
921
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
922
+ #
923
+ # Arguments +obj+ and +opts+ here are the same as
924
+ # arguments +obj+ and +opts+ in JSON.generate.
925
+ #
926
+ # Default options are:
927
+ # {
928
+ # indent: ' ', # Two spaces
929
+ # space: ' ', # One space
930
+ # array_nl: "\n", # Newline
931
+ # object_nl: "\n" # Newline
932
+ # }
933
+ #
934
+ # Example:
935
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
936
+ # json = JSON.pretty_generate(obj)
937
+ # puts json
938
+ # Output:
939
+ # {
940
+ # "foo": [
941
+ # "bar",
942
+ # "baz"
943
+ # ],
944
+ # "bat": {
945
+ # "bam": 0,
946
+ # "bad": 1
947
+ # }
948
+ # }
949
+ #
950
+ # source://json//lib/json/common.rb#373
951
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
952
+
953
+ # :stopdoc:
954
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
955
+ #
956
+ # source://json//lib/json/common.rb#373
957
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
958
+
959
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
960
+ #
961
+ # source://json//lib/json/common.rb#558
962
+ def recurse_proc(result, &proc); end
963
+
964
+ # source://json//lib/json/common.rb#540
965
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
966
+
967
+ # :stopdoc:
968
+ # I want to deprecate these later, so I'll first be silent about them, and
969
+ # later delete them.
970
+ #
971
+ # source://json//lib/json/common.rb#299
972
+ def unparse(obj, opts = T.unsafe(nil)); end
973
+
974
+ class << self
975
+ # :call-seq:
976
+ # JSON[object] -> new_array or new_string
977
+ #
978
+ # If +object+ is a \String,
979
+ # calls JSON.parse with +object+ and +opts+ (see method #parse):
980
+ # json = '[0, 1, null]'
981
+ # JSON[json]# => [0, 1, nil]
982
+ #
983
+ # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
984
+ # ruby = [0, 1, nil]
985
+ # JSON[ruby] # => '[0,1,null]'
986
+ #
987
+ # source://json//lib/json/common.rb#21
988
+ def [](object, opts = T.unsafe(nil)); end
989
+
990
+ # source://json//lib/json/common.rb#84
991
+ def create_fast_state; end
992
+
993
+ # Returns the current create identifier.
994
+ # See also JSON.create_id=.
995
+ #
996
+ # source://json//lib/json/common.rb#129
997
+ def create_id; end
998
+
999
+ # Sets create identifier, which is used to decide if the _json_create_
1000
+ # hook of a class should be called; initial value is +json_class+:
1001
+ # JSON.create_id # => 'json_class'
1002
+ #
1003
+ # source://json//lib/json/common.rb#123
1004
+ def create_id=(new_value); end
1005
+
1006
+ # source://json//lib/json/common.rb#94
1007
+ def create_pretty_state; end
1008
+
1009
+ # Return the constant located at _path_. The format of _path_ has to be
1010
+ # either ::A::B::C or A::B::C. In any case, A has to be located at the top
1011
+ # level (absolute namespace path?). If there doesn't exist a constant at
1012
+ # the given path, an ArgumentError is raised.
1013
+ #
1014
+ # source://json//lib/json/common.rb#45
1015
+ def deep_const_get(path); end
1016
+
1017
+ # :call-seq:
1018
+ # JSON.dump(obj, io = nil, limit = nil)
1019
+ #
1020
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
1021
+ #
1022
+ # The default options can be changed via method JSON.dump_default_options.
1023
+ #
1024
+ # - Argument +io+, if given, should respond to method +write+;
1025
+ # the \JSON \String is written to +io+, and +io+ is returned.
1026
+ # If +io+ is not given, the \JSON \String is returned.
1027
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
1028
+ #
1029
+ # ---
1030
+ #
1031
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
1032
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
1033
+ # json = JSON.dump(obj)
1034
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
1035
+ #
1036
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
1037
+ # path = 't.json'
1038
+ # File.open(path, 'w') do |file|
1039
+ # JSON.dump(obj, file)
1040
+ # end # => #<File:t.json (closed)>
1041
+ # puts File.read(path)
1042
+ # Output:
1043
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1044
+ #
1045
+ # source://json//lib/json/common.rb#614
1046
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil), kwargs = T.unsafe(nil)); end
1047
+
1048
+ # Sets or returns the default options for the JSON.dump method.
1049
+ # Initially:
1050
+ # opts = JSON.dump_default_options
1051
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1052
+ #
1053
+ # source://json//lib/json/common.rb#579
1054
+ def dump_default_options; end
1055
+
1056
+ # Sets or returns the default options for the JSON.dump method.
1057
+ # Initially:
1058
+ # opts = JSON.dump_default_options
1059
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false}
1060
+ #
1061
+ # source://json//lib/json/common.rb#579
1062
+ def dump_default_options=(_arg0); end
1063
+
1064
+ # :call-seq:
1065
+ # JSON.fast_generate(obj, opts) -> new_string
1066
+ #
1067
+ # Arguments +obj+ and +opts+ here are the same as
1068
+ # arguments +obj+ and +opts+ in JSON.generate.
1069
+ #
1070
+ # By default, generates \JSON data without checking
1071
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
1072
+ #
1073
+ # Raises an exception if +obj+ contains circular references:
1074
+ # a = []; b = []; a.push(b); b.push(a)
1075
+ # # Raises SystemStackError (stack level too deep):
1076
+ # JSON.fast_generate(a)
1077
+ #
1078
+ # source://json//lib/json/common.rb#328
1079
+ def fast_generate(obj, opts = T.unsafe(nil)); end
1080
+
1081
+ # :stopdoc:
1082
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1083
+ #
1084
+ # source://json//lib/json/common.rb#328
1085
+ def fast_unparse(obj, opts = T.unsafe(nil)); end
1086
+
1087
+ # :call-seq:
1088
+ # JSON.generate(obj, opts = nil) -> new_string
1089
+ #
1090
+ # Returns a \String containing the generated \JSON data.
1091
+ #
1092
+ # See also JSON.fast_generate, JSON.pretty_generate.
1093
+ #
1094
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
1095
+ #
1096
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
1097
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
1098
+ #
1099
+ # ---
1100
+ #
1101
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
1102
+ # obj = ["foo", 1.0, true, false, nil]
1103
+ # json = JSON.generate(obj)
1104
+ # json # => '["foo",1.0,true,false,null]'
1105
+ #
1106
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
1107
+ # obj = {foo: 0, bar: 's', baz: :bat}
1108
+ # json = JSON.generate(obj)
1109
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
1110
+ #
1111
+ # For examples of generating from other Ruby objects, see
1112
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
1113
+ #
1114
+ # ---
1115
+ #
1116
+ # Raises an exception if any formatting option is not a \String.
1117
+ #
1118
+ # Raises an exception if +obj+ contains circular references:
1119
+ # a = []; b = []; a.push(b); b.push(a)
1120
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
1121
+ # JSON.generate(a)
1122
+ #
1123
+ # source://json//lib/json/common.rb#299
1124
+ def generate(obj, opts = T.unsafe(nil)); end
1125
+
1126
+ # Returns the JSON generator module that is used by JSON. This is
1127
+ # either JSON::Ext::Generator or JSON::Pure::Generator:
1128
+ # JSON.generator # => JSON::Ext::Generator
1129
+ #
1130
+ # source://json//lib/json/common.rb#106
1131
+ def generator; end
1132
+
1133
+ # Set the module _generator_ to be used by JSON.
1134
+ #
1135
+ # source://json//lib/json/common.rb#61
1136
+ def generator=(generator); end
1137
+
1138
+ # Encodes string using String.encode.
1139
+ #
1140
+ # source://json//lib/json/common.rb#638
1141
+ def iconv(to, from, string); end
1142
+
1143
+ # :call-seq:
1144
+ # JSON.load(source, proc = nil, options = {}) -> object
1145
+ #
1146
+ # Returns the Ruby objects created by parsing the given +source+.
1147
+ #
1148
+ # - Argument +source+ must be, or be convertible to, a \String:
1149
+ # - If +source+ responds to instance method +to_str+,
1150
+ # <tt>source.to_str</tt> becomes the source.
1151
+ # - If +source+ responds to instance method +to_io+,
1152
+ # <tt>source.to_io.read</tt> becomes the source.
1153
+ # - If +source+ responds to instance method +read+,
1154
+ # <tt>source.read</tt> becomes the source.
1155
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1156
+ # - Option +allow_blank+ specifies a truthy value.
1157
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1158
+ # - Otherwise, +source+ remains the source.
1159
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1160
+ # It will be called recursively with each result (depth-first order).
1161
+ # See details below.
1162
+ # BEWARE: This method is meant to serialise data from trusted user input,
1163
+ # like from your own database server or clients under your control, it could
1164
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1165
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1166
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1167
+ # The default options can be changed via method JSON.load_default_options=.
1168
+ #
1169
+ # ---
1170
+ #
1171
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1172
+ # <tt>parse(source, opts)</tt>; see #parse.
1173
+ #
1174
+ # Source for following examples:
1175
+ # source = <<-EOT
1176
+ # {
1177
+ # "name": "Dave",
1178
+ # "age" :40,
1179
+ # "hats": [
1180
+ # "Cattleman's",
1181
+ # "Panama",
1182
+ # "Tophat"
1183
+ # ]
1184
+ # }
1185
+ # EOT
1186
+ #
1187
+ # Load a \String:
1188
+ # ruby = JSON.load(source)
1189
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1190
+ #
1191
+ # Load an \IO object:
1192
+ # require 'stringio'
1193
+ # object = JSON.load(StringIO.new(source))
1194
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1195
+ #
1196
+ # Load a \File object:
1197
+ # path = 't.json'
1198
+ # File.write(path, source)
1199
+ # File.open(path) do |file|
1200
+ # JSON.load(file)
1201
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1202
+ #
1203
+ # ---
1204
+ #
1205
+ # When +proc+ is given:
1206
+ # - Modifies +source+ as above.
1207
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1208
+ # - Recursively calls <tt>proc(result)</tt>.
1209
+ # - Returns the final result.
1210
+ #
1211
+ # Example:
1212
+ # require 'json'
1213
+ #
1214
+ # # Some classes for the example.
1215
+ # class Base
1216
+ # def initialize(attributes)
1217
+ # @attributes = attributes
1218
+ # end
1219
+ # end
1220
+ # class User < Base; end
1221
+ # class Account < Base; end
1222
+ # class Admin < Base; end
1223
+ # # The JSON source.
1224
+ # json = <<-EOF
1225
+ # {
1226
+ # "users": [
1227
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1228
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1229
+ # ],
1230
+ # "accounts": [
1231
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1232
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1233
+ # ],
1234
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1235
+ # }
1236
+ # EOF
1237
+ # # Deserializer method.
1238
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1239
+ # type = obj.is_a?(Hash) && obj["type"]
1240
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1241
+ # end
1242
+ # # Call to JSON.load
1243
+ # ruby = JSON.load(json, proc {|obj|
1244
+ # case obj
1245
+ # when Hash
1246
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1247
+ # when Array
1248
+ # obj.map! {|v| deserialize_obj v }
1249
+ # end
1250
+ # })
1251
+ # pp ruby
1252
+ # Output:
1253
+ # {"users"=>
1254
+ # [#<User:0x00000000064c4c98
1255
+ # @attributes=
1256
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1257
+ # #<User:0x00000000064c4bd0
1258
+ # @attributes=
1259
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1260
+ # "accounts"=>
1261
+ # [{"account"=>
1262
+ # #<Account:0x00000000064c4928
1263
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1264
+ # {"account"=>
1265
+ # #<Account:0x00000000064c4680
1266
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1267
+ # "admins"=>
1268
+ # #<Admin:0x00000000064c41f8
1269
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1270
+ #
1271
+ # source://json//lib/json/common.rb#540
1272
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1273
+
1274
+ # Sets or returns default options for the JSON.load method.
1275
+ # Initially:
1276
+ # opts = JSON.load_default_options
1277
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1278
+ #
1279
+ # source://json//lib/json/common.rb#403
1280
+ def load_default_options; end
1281
+
1282
+ # Sets or returns default options for the JSON.load method.
1283
+ # Initially:
1284
+ # opts = JSON.load_default_options
1285
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1286
+ #
1287
+ # source://json//lib/json/common.rb#403
1288
+ def load_default_options=(_arg0); end
1289
+
1290
+ # :call-seq:
1291
+ # JSON.load_file(path, opts={}) -> object
1292
+ #
1293
+ # Calls:
1294
+ # parse(File.read(path), opts)
1295
+ #
1296
+ # See method #parse.
1297
+ #
1298
+ # source://json//lib/json/common.rb#248
1299
+ def load_file(filespec, opts = T.unsafe(nil)); end
1300
+
1301
+ # :call-seq:
1302
+ # JSON.load_file!(path, opts = {})
1303
+ #
1304
+ # Calls:
1305
+ # JSON.parse!(File.read(path, opts))
1306
+ #
1307
+ # See method #parse!
1308
+ #
1309
+ # source://json//lib/json/common.rb#259
1310
+ def load_file!(filespec, opts = T.unsafe(nil)); end
1311
+
1312
+ # :call-seq:
1313
+ # JSON.parse(source, opts) -> object
1314
+ #
1315
+ # Returns the Ruby objects created by parsing the given +source+.
1316
+ #
1317
+ # Argument +source+ contains the \String to be parsed.
1318
+ #
1319
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
1320
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1321
+ #
1322
+ # ---
1323
+ #
1324
+ # When +source+ is a \JSON array, returns a Ruby \Array:
1325
+ # source = '["foo", 1.0, true, false, null]'
1326
+ # ruby = JSON.parse(source)
1327
+ # ruby # => ["foo", 1.0, true, false, nil]
1328
+ # ruby.class # => Array
1329
+ #
1330
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
1331
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
1332
+ # ruby = JSON.parse(source)
1333
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
1334
+ # ruby.class # => Hash
1335
+ #
1336
+ # For examples of parsing for all \JSON data types, see
1337
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
1338
+ #
1339
+ # Parses nested JSON objects:
1340
+ # source = <<-EOT
1341
+ # {
1342
+ # "name": "Dave",
1343
+ # "age" :40,
1344
+ # "hats": [
1345
+ # "Cattleman's",
1346
+ # "Panama",
1347
+ # "Tophat"
1348
+ # ]
1349
+ # }
1350
+ # EOT
1351
+ # ruby = JSON.parse(source)
1352
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1353
+ #
1354
+ # ---
1355
+ #
1356
+ # Raises an exception if +source+ is not valid JSON:
1357
+ # # Raises JSON::ParserError (783: unexpected token at ''):
1358
+ # JSON.parse('')
1359
+ #
1360
+ # source://json//lib/json/common.rb#218
1361
+ def parse(source, opts = T.unsafe(nil)); end
1362
+
1363
+ # :call-seq:
1364
+ # JSON.parse!(source, opts) -> object
1365
+ #
1366
+ # Calls
1367
+ # parse(source, opts)
1368
+ # with +source+ and possibly modified +opts+.
1369
+ #
1370
+ # Differences from JSON.parse:
1371
+ # - Option +max_nesting+, if not provided, defaults to +false+,
1372
+ # which disables checking for nesting depth.
1373
+ # - Option +allow_nan+, if not provided, defaults to +true+.
1374
+ #
1375
+ # source://json//lib/json/common.rb#233
1376
+ def parse!(source, opts = T.unsafe(nil)); end
1377
+
1378
+ # Returns the JSON parser class that is used by JSON. This is either
1379
+ # JSON::Ext::Parser or JSON::Pure::Parser:
1380
+ # JSON.parser # => JSON::Ext::Parser
1381
+ #
1382
+ # source://json//lib/json/common.rb#32
1383
+ def parser; end
1384
+
1385
+ # Set the JSON parser class _parser_ to be used by JSON.
1386
+ #
1387
+ # source://json//lib/json/common.rb#35
1388
+ def parser=(parser); end
1389
+
1390
+ # :call-seq:
1391
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
1392
+ #
1393
+ # Arguments +obj+ and +opts+ here are the same as
1394
+ # arguments +obj+ and +opts+ in JSON.generate.
1395
+ #
1396
+ # Default options are:
1397
+ # {
1398
+ # indent: ' ', # Two spaces
1399
+ # space: ' ', # One space
1400
+ # array_nl: "\n", # Newline
1401
+ # object_nl: "\n" # Newline
1402
+ # }
1403
+ #
1404
+ # Example:
1405
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
1406
+ # json = JSON.pretty_generate(obj)
1407
+ # puts json
1408
+ # Output:
1409
+ # {
1410
+ # "foo": [
1411
+ # "bar",
1412
+ # "baz"
1413
+ # ],
1414
+ # "bat": {
1415
+ # "bam": 0,
1416
+ # "bad": 1
1417
+ # }
1418
+ # }
1419
+ #
1420
+ # source://json//lib/json/common.rb#373
1421
+ def pretty_generate(obj, opts = T.unsafe(nil)); end
1422
+
1423
+ # :stopdoc:
1424
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1425
+ #
1426
+ # source://json//lib/json/common.rb#373
1427
+ def pretty_unparse(obj, opts = T.unsafe(nil)); end
1428
+
1429
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1430
+ #
1431
+ # source://json//lib/json/common.rb#558
1432
+ def recurse_proc(result, &proc); end
1433
+
1434
+ # source://json//lib/json/common.rb#540
1435
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil)); end
1436
+
1437
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1438
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1439
+ # JSON.state # => JSON::Ext::Generator::State
1440
+ #
1441
+ # source://json//lib/json/common.rb#111
1442
+ def state; end
1443
+
1444
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1445
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1446
+ # JSON.state # => JSON::Ext::Generator::State
1447
+ #
1448
+ # source://json//lib/json/common.rb#111
1449
+ def state=(_arg0); end
1450
+
1451
+ # :stopdoc:
1452
+ # I want to deprecate these later, so I'll first be silent about them, and
1453
+ # later delete them.
1454
+ #
1455
+ # source://json//lib/json/common.rb#299
1456
+ def unparse(obj, opts = T.unsafe(nil)); end
1457
+
1458
+ private
1459
+
1460
+ # source://json//lib/json/common.rb#642
1461
+ def merge_dump_options(opts, strict: T.unsafe(nil)); end
1462
+ end
1463
+ end
1464
+
1465
+ # source://json//lib/json/common.rb#117
1466
+ JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1467
+
1468
+ # source://json//lib/json/common.rb#114
1469
+ JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1470
+
1471
+ # source://json//lib/json/generic_object.rb#5
1472
+ class JSON::GenericObject < ::OpenStruct
1473
+ # source://json//lib/json/generic_object.rb#63
1474
+ def as_json(*_arg0); end
1475
+
1476
+ # source://json//lib/json/generic_object.rb#47
1477
+ def to_hash; end
1478
+
1479
+ # source://json//lib/json/generic_object.rb#67
1480
+ def to_json(*a); end
1481
+
1482
+ # source://json//lib/json/generic_object.rb#59
1483
+ def |(other); end
1484
+
1485
+ class << self
1486
+ # source://json//lib/json/generic_object.rb#41
1487
+ def dump(obj, *args); end
1488
+
1489
+ # source://json//lib/json/generic_object.rb#21
1490
+ def from_hash(object); end
1491
+
1492
+ # Sets the attribute json_creatable
1493
+ #
1494
+ # @param value the value to set the attribute json_creatable to.
1495
+ #
1496
+ # source://json//lib/json/generic_object.rb#13
1497
+ def json_creatable=(_arg0); end
1498
+
1499
+ # @return [Boolean]
1500
+ #
1501
+ # source://json//lib/json/generic_object.rb#9
1502
+ def json_creatable?; end
1503
+
1504
+ # source://json//lib/json/generic_object.rb#15
1505
+ def json_create(data); end
1506
+
1507
+ # source://json//lib/json/generic_object.rb#36
1508
+ def load(source, proc = T.unsafe(nil), opts = T.unsafe(nil)); end
1509
+ end
1510
+ end
1511
+
1512
+ # The base exception for JSON errors.
1513
+ #
1514
+ # source://json//lib/json/common.rb#140
1515
+ class JSON::JSONError < ::StandardError
1516
+ class << self
1517
+ # source://json//lib/json/common.rb#141
1518
+ def wrap(exception); end
1519
+ end
1520
+ end
1521
+
1522
+ # source://json//lib/json/common.rb#6
1523
+ JSON::NOT_SET = T.let(T.unsafe(nil), Object)
1524
+
1525
+ # source://json//lib/json/common.rb#38
1526
+ JSON::Parser = JSON::Ext::Parser
1527
+
1528
+ # source://json//lib/json/common.rb#76
1529
+ JSON::State = JSON::Ext::Generator::State
1530
+
1531
+ # For backwards compatibility
1532
+ #
1533
+ # source://json//lib/json/common.rb#162
1534
+ JSON::UnparserError = JSON::GeneratorError
1535
+
1536
+ # source://json//lib/json/common.rb#652
1537
+ module Kernel
1538
+ private
1539
+
1540
+ # If _object_ is string-like, parse the string and return the parsed result as
1541
+ # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
1542
+ # structure object and return it.
1543
+ #
1544
+ # The _opts_ argument is passed through to generate/parse respectively. See
1545
+ # generate and parse for their documentation.
1546
+ #
1547
+ # source://json//lib/json/common.rb#679
1548
+ def JSON(object, *args); end
1549
+
1550
+ # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1551
+ # one line.
1552
+ #
1553
+ # source://json//lib/json/common.rb#657
1554
+ def j(*objs); end
1555
+
1556
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1557
+ # indentation and over many lines.
1558
+ #
1559
+ # source://json//lib/json/common.rb#666
1560
+ def jj(*objs); end
1561
+ end