mootool 0.1.0 → 0.2

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.github/workflows/ci.yml +37 -0
  4. data/.github/workflows/gem-push.yml +44 -0
  5. data/.overcommit.yml +79 -0
  6. data/.rubocop.yml +144 -0
  7. data/.ruby-version +1 -1
  8. data/.run/All Specs.run.xml +46 -0
  9. data/CODE_OF_CONDUCT.md +2 -1
  10. data/Gemfile +14 -11
  11. data/Gemfile.lock +93 -34
  12. data/README.md +12 -6
  13. data/bin/tapioca +27 -0
  14. data/lib/mootool/command.rb +1 -0
  15. data/lib/mootool/controller_base.rb +4 -1
  16. data/lib/mootool/controllers/dwarf.rb +8 -0
  17. data/lib/mootool/controllers/dyld_linker.rb +8 -0
  18. data/lib/mootool/controllers/dyld_shared_cache.rb +8 -0
  19. data/lib/mootool/controllers/fat_binary.rb +8 -0
  20. data/lib/mootool/controllers/kernel_collection.rb +21 -15
  21. data/lib/mootool/controllers/sections.rb +8 -0
  22. data/lib/mootool/core_extensions.rb +26 -0
  23. data/lib/mootool/models/device_tree.rb +85 -0
  24. data/lib/mootool/models/img4.rb +49 -0
  25. data/lib/mootool/models/ipsw.rb +19 -0
  26. data/lib/mootool/version.rb +1 -1
  27. data/lib/mootool/views/sections.full.erb +2 -2
  28. data/lib/mootool.rb +10 -3
  29. data/mootool.gemspec +17 -14
  30. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  31. data/sorbet/rbi/gems/ast@2.4.2.rbi +618 -0
  32. data/sorbet/rbi/gems/childprocess@4.1.0.rbi +447 -0
  33. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  34. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1219 -0
  35. data/sorbet/rbi/gems/iniparse@1.5.0.rbi +1007 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1650 -0
  37. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  38. data/sorbet/rbi/gems/netrc@0.11.0.rbi +186 -0
  39. data/sorbet/rbi/gems/overcommit@0.59.1.rbi +2747 -0
  40. data/sorbet/rbi/gems/parallel@1.22.1.rbi +353 -0
  41. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +6198 -0
  42. data/sorbet/rbi/gems/plist@3.6.0.rbi +212 -0
  43. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  44. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +452 -0
  45. data/sorbet/rbi/gems/rake@13.0.6.rbi +3587 -0
  46. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3619 -0
  47. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3927 -0
  48. data/sorbet/rbi/gems/rexml@3.2.5.rbi +5238 -0
  49. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +12834 -0
  50. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +9151 -0
  51. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +6506 -0
  52. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +2040 -0
  53. data/sorbet/rbi/gems/rspec@3.11.0.rbi +120 -0
  54. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +7990 -0
  55. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +413 -0
  56. data/sorbet/rbi/gems/rubocop-rspec@2.12.1.rbi +7604 -0
  57. data/sorbet/rbi/gems/rubocop@1.35.0.rbi +62260 -0
  58. data/sorbet/rbi/gems/ruby-macho@3.0.0.rbi +5039 -0
  59. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1445 -0
  60. data/sorbet/rbi/gems/rubyzip@2.3.2.rbi +2868 -0
  61. data/sorbet/rbi/gems/spoom@1.1.12.rbi +2829 -0
  62. data/sorbet/rbi/gems/tapioca@0.9.3.rbi +2151 -0
  63. data/sorbet/rbi/gems/thor@1.2.1.rbi +4532 -0
  64. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +60 -0
  65. data/sorbet/rbi/gems/unparser@0.6.5.rbi +8 -0
  66. data/sorbet/rbi/gems/webrick@1.7.0.rbi +3075 -0
  67. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +458 -0
  68. data/sorbet/rbi/gems/yard@0.9.28.rbi +20844 -0
  69. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +72 -24
  70. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +1697 -385
  71. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +30 -7
  72. data/sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi +3 -1
  73. data/sorbet/rbi/todo.rbi +7 -0
  74. data/sorbet/tapioca/config.yml +13 -0
  75. data/sorbet/tapioca/require.rb +4 -0
  76. metadata +95 -14
@@ -0,0 +1,1650 @@
1
+ # typed: true
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-2.6.2/lib/json/common.rb:695
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-2.6.2/lib/json/common.rb:700
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
+ # ====== Output Options
306
+ #
307
+ # The default formatting options generate the most compact
308
+ # \JSON data, all on one line and with no whitespace.
309
+ #
310
+ # You can use these formatting options to generate
311
+ # \JSON data in a more open format, using whitespace.
312
+ # See also JSON.pretty_generate.
313
+ #
314
+ # - Option +array_nl+ (\String) specifies a string (usually a newline)
315
+ # to be inserted after each \JSON array; defaults to the empty \String, <tt>''</tt>.
316
+ # - Option +object_nl+ (\String) specifies a string (usually a newline)
317
+ # to be inserted after each \JSON object; defaults to the empty \String, <tt>''</tt>.
318
+ # - Option +indent+ (\String) specifies the string (usually spaces) to be
319
+ # used for indentation; defaults to the empty \String, <tt>''</tt>;
320
+ # defaults to the empty \String, <tt>''</tt>;
321
+ # has no effect unless options +array_nl+ or +object_nl+ specify newlines.
322
+ # - Option +space+ (\String) specifies a string (usually a space) to be
323
+ # inserted after the colon in each \JSON object's pair;
324
+ # defaults to the empty \String, <tt>''</tt>.
325
+ # - Option +space_before+ (\String) specifies a string (usually a space) to be
326
+ # inserted before the colon in each \JSON object's pair;
327
+ # defaults to the empty \String, <tt>''</tt>.
328
+ #
329
+ # In this example, +obj+ is used first to generate the shortest
330
+ # \JSON data (no whitespace), then again with all formatting options
331
+ # specified:
332
+ #
333
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
334
+ # json = JSON.generate(obj)
335
+ # puts 'Compact:', json
336
+ # opts = {
337
+ # array_nl: "\n",
338
+ # object_nl: "\n",
339
+ # indent: ' ',
340
+ # space_before: ' ',
341
+ # space: ' '
342
+ # }
343
+ # puts 'Open:', JSON.generate(obj, opts)
344
+ #
345
+ # Output:
346
+ # Compact:
347
+ # {"foo":["bar","baz"],"bat":{"bam":0,"bad":1}}
348
+ # Open:
349
+ # {
350
+ # "foo" : [
351
+ # "bar",
352
+ # "baz"
353
+ # ],
354
+ # "bat" : {
355
+ # "bam" : 0,
356
+ # "bad" : 1
357
+ # }
358
+ # }
359
+ #
360
+ # == \JSON Additions
361
+ #
362
+ # When you "round trip" a non-\String object from Ruby to \JSON and back,
363
+ # you have a new \String, instead of the object you began with:
364
+ # ruby0 = Range.new(0, 2)
365
+ # json = JSON.generate(ruby0)
366
+ # json # => '0..2"'
367
+ # ruby1 = JSON.parse(json)
368
+ # ruby1 # => '0..2'
369
+ # ruby1.class # => String
370
+ #
371
+ # You can use \JSON _additions_ to preserve the original object.
372
+ # The addition is an extension of a ruby class, so that:
373
+ # - \JSON.generate stores more information in the \JSON string.
374
+ # - \JSON.parse, called with option +create_additions+,
375
+ # uses that information to create a proper Ruby object.
376
+ #
377
+ # This example shows a \Range being generated into \JSON
378
+ # and parsed back into Ruby, both without and with
379
+ # the addition for \Range:
380
+ # ruby = Range.new(0, 2)
381
+ # # This passage does not use the addition for Range.
382
+ # json0 = JSON.generate(ruby)
383
+ # ruby0 = JSON.parse(json0)
384
+ # # This passage uses the addition for Range.
385
+ # require 'json/add/range'
386
+ # json1 = JSON.generate(ruby)
387
+ # ruby1 = JSON.parse(json1, create_additions: true)
388
+ # # Make a nice display.
389
+ # display = <<EOT
390
+ # Generated JSON:
391
+ # Without addition: #{json0} (#{json0.class})
392
+ # With addition: #{json1} (#{json1.class})
393
+ # Parsed JSON:
394
+ # Without addition: #{ruby0.inspect} (#{ruby0.class})
395
+ # With addition: #{ruby1.inspect} (#{ruby1.class})
396
+ # EOT
397
+ # puts display
398
+ #
399
+ # This output shows the different results:
400
+ # Generated JSON:
401
+ # Without addition: "0..2" (String)
402
+ # With addition: {"json_class":"Range","a":[0,2,false]} (String)
403
+ # Parsed JSON:
404
+ # Without addition: "0..2" (String)
405
+ # With addition: 0..2 (Range)
406
+ #
407
+ # The \JSON module includes additions for certain classes.
408
+ # You can also craft custom additions.
409
+ # See {Custom \JSON Additions}[#module-JSON-label-Custom+JSON+Additions].
410
+ #
411
+ # === Built-in Additions
412
+ #
413
+ # The \JSON module includes additions for certain classes.
414
+ # To use an addition, +require+ its source:
415
+ # - BigDecimal: <tt>require 'json/add/bigdecimal'</tt>
416
+ # - Complex: <tt>require 'json/add/complex'</tt>
417
+ # - Date: <tt>require 'json/add/date'</tt>
418
+ # - DateTime: <tt>require 'json/add/date_time'</tt>
419
+ # - Exception: <tt>require 'json/add/exception'</tt>
420
+ # - OpenStruct: <tt>require 'json/add/ostruct'</tt>
421
+ # - Range: <tt>require 'json/add/range'</tt>
422
+ # - Rational: <tt>require 'json/add/rational'</tt>
423
+ # - Regexp: <tt>require 'json/add/regexp'</tt>
424
+ # - Set: <tt>require 'json/add/set'</tt>
425
+ # - Struct: <tt>require 'json/add/struct'</tt>
426
+ # - Symbol: <tt>require 'json/add/symbol'</tt>
427
+ # - Time: <tt>require 'json/add/time'</tt>
428
+ #
429
+ # To reduce punctuation clutter, the examples below
430
+ # show the generated \JSON via +puts+, rather than the usual +inspect+,
431
+ #
432
+ # \BigDecimal:
433
+ # require 'json/add/bigdecimal'
434
+ # ruby0 = BigDecimal(0) # 0.0
435
+ # json = JSON.generate(ruby0) # {"json_class":"BigDecimal","b":"27:0.0"}
436
+ # ruby1 = JSON.parse(json, create_additions: true) # 0.0
437
+ # ruby1.class # => BigDecimal
438
+ #
439
+ # \Complex:
440
+ # require 'json/add/complex'
441
+ # ruby0 = Complex(1+0i) # 1+0i
442
+ # json = JSON.generate(ruby0) # {"json_class":"Complex","r":1,"i":0}
443
+ # ruby1 = JSON.parse(json, create_additions: true) # 1+0i
444
+ # ruby1.class # Complex
445
+ #
446
+ # \Date:
447
+ # require 'json/add/date'
448
+ # ruby0 = Date.today # 2020-05-02
449
+ # json = JSON.generate(ruby0) # {"json_class":"Date","y":2020,"m":5,"d":2,"sg":2299161.0}
450
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02
451
+ # ruby1.class # Date
452
+ #
453
+ # \DateTime:
454
+ # require 'json/add/date_time'
455
+ # ruby0 = DateTime.now # 2020-05-02T10:38:13-05:00
456
+ # 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}
457
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02T10:38:13-05:00
458
+ # ruby1.class # DateTime
459
+ #
460
+ # \Exception (and its subclasses including \RuntimeError):
461
+ # require 'json/add/exception'
462
+ # ruby0 = Exception.new('A message') # A message
463
+ # json = JSON.generate(ruby0) # {"json_class":"Exception","m":"A message","b":null}
464
+ # ruby1 = JSON.parse(json, create_additions: true) # A message
465
+ # ruby1.class # Exception
466
+ # ruby0 = RuntimeError.new('Another message') # Another message
467
+ # json = JSON.generate(ruby0) # {"json_class":"RuntimeError","m":"Another message","b":null}
468
+ # ruby1 = JSON.parse(json, create_additions: true) # Another message
469
+ # ruby1.class # RuntimeError
470
+ #
471
+ # \OpenStruct:
472
+ # require 'json/add/ostruct'
473
+ # ruby0 = OpenStruct.new(name: 'Matz', language: 'Ruby') # #<OpenStruct name="Matz", language="Ruby">
474
+ # json = JSON.generate(ruby0) # {"json_class":"OpenStruct","t":{"name":"Matz","language":"Ruby"}}
475
+ # ruby1 = JSON.parse(json, create_additions: true) # #<OpenStruct name="Matz", language="Ruby">
476
+ # ruby1.class # OpenStruct
477
+ #
478
+ # \Range:
479
+ # require 'json/add/range'
480
+ # ruby0 = Range.new(0, 2) # 0..2
481
+ # json = JSON.generate(ruby0) # {"json_class":"Range","a":[0,2,false]}
482
+ # ruby1 = JSON.parse(json, create_additions: true) # 0..2
483
+ # ruby1.class # Range
484
+ #
485
+ # \Rational:
486
+ # require 'json/add/rational'
487
+ # ruby0 = Rational(1, 3) # 1/3
488
+ # json = JSON.generate(ruby0) # {"json_class":"Rational","n":1,"d":3}
489
+ # ruby1 = JSON.parse(json, create_additions: true) # 1/3
490
+ # ruby1.class # Rational
491
+ #
492
+ # \Regexp:
493
+ # require 'json/add/regexp'
494
+ # ruby0 = Regexp.new('foo') # (?-mix:foo)
495
+ # json = JSON.generate(ruby0) # {"json_class":"Regexp","o":0,"s":"foo"}
496
+ # ruby1 = JSON.parse(json, create_additions: true) # (?-mix:foo)
497
+ # ruby1.class # Regexp
498
+ #
499
+ # \Set:
500
+ # require 'json/add/set'
501
+ # ruby0 = Set.new([0, 1, 2]) # #<Set: {0, 1, 2}>
502
+ # json = JSON.generate(ruby0) # {"json_class":"Set","a":[0,1,2]}
503
+ # ruby1 = JSON.parse(json, create_additions: true) # #<Set: {0, 1, 2}>
504
+ # ruby1.class # Set
505
+ #
506
+ # \Struct:
507
+ # require 'json/add/struct'
508
+ # Customer = Struct.new(:name, :address) # Customer
509
+ # ruby0 = Customer.new("Dave", "123 Main") # #<struct Customer name="Dave", address="123 Main">
510
+ # json = JSON.generate(ruby0) # {"json_class":"Customer","v":["Dave","123 Main"]}
511
+ # ruby1 = JSON.parse(json, create_additions: true) # #<struct Customer name="Dave", address="123 Main">
512
+ # ruby1.class # Customer
513
+ #
514
+ # \Symbol:
515
+ # require 'json/add/symbol'
516
+ # ruby0 = :foo # foo
517
+ # json = JSON.generate(ruby0) # {"json_class":"Symbol","s":"foo"}
518
+ # ruby1 = JSON.parse(json, create_additions: true) # foo
519
+ # ruby1.class # Symbol
520
+ #
521
+ # \Time:
522
+ # require 'json/add/time'
523
+ # ruby0 = Time.now # 2020-05-02 11:28:26 -0500
524
+ # json = JSON.generate(ruby0) # {"json_class":"Time","s":1588436906,"n":840560000}
525
+ # ruby1 = JSON.parse(json, create_additions: true) # 2020-05-02 11:28:26 -0500
526
+ # ruby1.class # Time
527
+ #
528
+ #
529
+ # === Custom \JSON Additions
530
+ #
531
+ # In addition to the \JSON additions provided,
532
+ # you can craft \JSON additions of your own,
533
+ # either for Ruby built-in classes or for user-defined classes.
534
+ #
535
+ # Here's a user-defined class +Foo+:
536
+ # class Foo
537
+ # attr_accessor :bar, :baz
538
+ # def initialize(bar, baz)
539
+ # self.bar = bar
540
+ # self.baz = baz
541
+ # end
542
+ # end
543
+ #
544
+ # Here's the \JSON addition for it:
545
+ # # Extend class Foo with JSON addition.
546
+ # class Foo
547
+ # # Serialize Foo object with its class name and arguments
548
+ # def to_json(*args)
549
+ # {
550
+ # JSON.create_id => self.class.name,
551
+ # 'a' => [ bar, baz ]
552
+ # }.to_json(*args)
553
+ # end
554
+ # # Deserialize JSON string by constructing new Foo object with arguments.
555
+ # def self.json_create(object)
556
+ # new(*object['a'])
557
+ # end
558
+ # end
559
+ #
560
+ # Demonstration:
561
+ # require 'json'
562
+ # # This Foo object has no custom addition.
563
+ # foo0 = Foo.new(0, 1)
564
+ # json0 = JSON.generate(foo0)
565
+ # obj0 = JSON.parse(json0)
566
+ # # Lood the custom addition.
567
+ # require_relative 'foo_addition'
568
+ # # This foo has the custom addition.
569
+ # foo1 = Foo.new(0, 1)
570
+ # json1 = JSON.generate(foo1)
571
+ # obj1 = JSON.parse(json1, create_additions: true)
572
+ # # Make a nice display.
573
+ # display = <<EOT
574
+ # Generated JSON:
575
+ # Without custom addition: #{json0} (#{json0.class})
576
+ # With custom addition: #{json1} (#{json1.class})
577
+ # Parsed JSON:
578
+ # Without custom addition: #{obj0.inspect} (#{obj0.class})
579
+ # With custom addition: #{obj1.inspect} (#{obj1.class})
580
+ # EOT
581
+ # puts display
582
+ #
583
+ # Output:
584
+ #
585
+ # Generated JSON:
586
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
587
+ # With custom addition: {"json_class":"Foo","a":[0,1]} (String)
588
+ # Parsed JSON:
589
+ # Without custom addition: "#<Foo:0x0000000006534e80>" (String)
590
+ # With custom addition: #<Foo:0x0000000006473bb8 @bar=0, @baz=1> (Foo)
591
+ #
592
+ # source://json-2.6.2/lib/json/version.rb:2
593
+ module JSON
594
+ private
595
+
596
+ # :call-seq:
597
+ # JSON.dump(obj, io = nil, limit = nil)
598
+ #
599
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
600
+ #
601
+ # The default options can be changed via method JSON.dump_default_options.
602
+ #
603
+ # - Argument +io+, if given, should respond to method +write+;
604
+ # the \JSON \String is written to +io+, and +io+ is returned.
605
+ # If +io+ is not given, the \JSON \String is returned.
606
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
607
+ #
608
+ # ---
609
+ #
610
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
611
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
612
+ # json = JSON.dump(obj)
613
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
614
+ #
615
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
616
+ # path = 't.json'
617
+ # File.open(path, 'w') do |file|
618
+ # JSON.dump(obj, file)
619
+ # end # => #<File:t.json (closed)>
620
+ # puts File.read(path)
621
+ # Output:
622
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
623
+ #
624
+ # source://json-2.6.2/lib/json/common.rb:631
625
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil))
626
+ ;
627
+ end
628
+
629
+ # :call-seq:
630
+ # JSON.fast_generate(obj, opts) -> new_string
631
+ #
632
+ # Arguments +obj+ and +opts+ here are the same as
633
+ # arguments +obj+ and +opts+ in JSON.generate.
634
+ #
635
+ # By default, generates \JSON data without checking
636
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
637
+ #
638
+ # Raises an exception if +obj+ contains circular references:
639
+ # a = []; b = []; a.push(b); b.push(a)
640
+ # # Raises SystemStackError (stack level too deep):
641
+ # JSON.fast_generate(a)
642
+ #
643
+ # source://json-2.6.2/lib/json/common.rb:335
644
+ def fast_generate(obj, opts = T.unsafe(nil))
645
+ ;
646
+ end
647
+
648
+ # :stopdoc:
649
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
650
+ #
651
+ # source://json-2.6.2/lib/json/common.rb:335
652
+ def fast_unparse(obj, opts = T.unsafe(nil))
653
+ ;
654
+ end
655
+
656
+ # :call-seq:
657
+ # JSON.generate(obj, opts = nil) -> new_string
658
+ #
659
+ # Returns a \String containing the generated \JSON data.
660
+ #
661
+ # See also JSON.fast_generate, JSON.pretty_generate.
662
+ #
663
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
664
+ #
665
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
666
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
667
+ #
668
+ # ---
669
+ #
670
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
671
+ # obj = ["foo", 1.0, true, false, nil]
672
+ # json = JSON.generate(obj)
673
+ # json # => '["foo",1.0,true,false,null]'
674
+ #
675
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
676
+ # obj = {foo: 0, bar: 's', baz: :bat}
677
+ # json = JSON.generate(obj)
678
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
679
+ #
680
+ # For examples of generating from other Ruby objects, see
681
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
682
+ #
683
+ # ---
684
+ #
685
+ # Raises an exception if any formatting option is not a \String.
686
+ #
687
+ # Raises an exception if +obj+ contains circular references:
688
+ # a = []; b = []; a.push(b); b.push(a)
689
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
690
+ # JSON.generate(a)
691
+ #
692
+ # source://json-2.6.2/lib/json/common.rb:296
693
+ def generate(obj, opts = T.unsafe(nil))
694
+ ;
695
+ end
696
+
697
+ # :call-seq:
698
+ # JSON.load(source, proc = nil, options = {}) -> object
699
+ #
700
+ # Returns the Ruby objects created by parsing the given +source+.
701
+ #
702
+ # - Argument +source+ must be, or be convertible to, a \String:
703
+ # - If +source+ responds to instance method +to_str+,
704
+ # <tt>source.to_str</tt> becomes the source.
705
+ # - If +source+ responds to instance method +to_io+,
706
+ # <tt>source.to_io.read</tt> becomes the source.
707
+ # - If +source+ responds to instance method +read+,
708
+ # <tt>source.read</tt> becomes the source.
709
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
710
+ # - Option +allow_blank+ specifies a truthy value.
711
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
712
+ # - Otherwise, +source+ remains the source.
713
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
714
+ # It will be called recursively with each result (depth-first order).
715
+ # See details below.
716
+ # BEWARE: This method is meant to serialise data from trusted user input,
717
+ # like from your own database server or clients under your control, it could
718
+ # be dangerous to allow untrusted users to pass JSON sources into it.
719
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
720
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
721
+ # The default options can be changed via method JSON.load_default_options=.
722
+ #
723
+ # ---
724
+ #
725
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
726
+ # <tt>parse(source, opts)</tt>; see #parse.
727
+ #
728
+ # Source for following examples:
729
+ # source = <<-EOT
730
+ # {
731
+ # "name": "Dave",
732
+ # "age" :40,
733
+ # "hats": [
734
+ # "Cattleman's",
735
+ # "Panama",
736
+ # "Tophat"
737
+ # ]
738
+ # }
739
+ # EOT
740
+ #
741
+ # Load a \String:
742
+ # ruby = JSON.load(source)
743
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
744
+ #
745
+ # Load an \IO object:
746
+ # require 'stringio'
747
+ # object = JSON.load(StringIO.new(source))
748
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
749
+ #
750
+ # Load a \File object:
751
+ # path = 't.json'
752
+ # File.write(path, source)
753
+ # File.open(path) do |file|
754
+ # JSON.load(file)
755
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
756
+ #
757
+ # ---
758
+ #
759
+ # When +proc+ is given:
760
+ # - Modifies +source+ as above.
761
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
762
+ # - Recursively calls <tt>proc(result)</tt>.
763
+ # - Returns the final result.
764
+ #
765
+ # Example:
766
+ # require 'json'
767
+ #
768
+ # # Some classes for the example.
769
+ # class Base
770
+ # def initialize(attributes)
771
+ # @attributes = attributes
772
+ # end
773
+ # end
774
+ # class User < Base; end
775
+ # class Account < Base; end
776
+ # class Admin < Base; end
777
+ # # The JSON source.
778
+ # json = <<-EOF
779
+ # {
780
+ # "users": [
781
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
782
+ # {"type": "User", "username": "john", "email": "john@example.com"}
783
+ # ],
784
+ # "accounts": [
785
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
786
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
787
+ # ],
788
+ # "admins": {"type": "Admin", "password": "0wn3d"}
789
+ # }
790
+ # EOF
791
+ # # Deserializer method.
792
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
793
+ # type = obj.is_a?(Hash) && obj["type"]
794
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
795
+ # end
796
+ # # Call to JSON.load
797
+ # ruby = JSON.load(json, proc {|obj|
798
+ # case obj
799
+ # when Hash
800
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
801
+ # when Array
802
+ # obj.map! {|v| deserialize_obj v }
803
+ # end
804
+ # })
805
+ # pp ruby
806
+ # Output:
807
+ # {"users"=>
808
+ # [#<User:0x00000000064c4c98
809
+ # @attributes=
810
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
811
+ # #<User:0x00000000064c4bd0
812
+ # @attributes=
813
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
814
+ # "accounts"=>
815
+ # [{"account"=>
816
+ # #<Account:0x00000000064c4928
817
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
818
+ # {"account"=>
819
+ # #<Account:0x00000000064c4680
820
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
821
+ # "admins"=>
822
+ # #<Admin:0x00000000064c41f8
823
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
824
+ #
825
+ # source://json-2.6.2/lib/json/common.rb:557
826
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil))
827
+ ;
828
+ end
829
+
830
+ # :call-seq:
831
+ # JSON.load_file(path, opts={}) -> object
832
+ #
833
+ # Calls:
834
+ # parse(File.read(path), opts)
835
+ #
836
+ # See method #parse.
837
+ #
838
+ # source://json-2.6.2/lib/json/common.rb:245
839
+ def load_file(filespec, opts = T.unsafe(nil))
840
+ ;
841
+ end
842
+
843
+ # :call-seq:
844
+ # JSON.load_file!(path, opts = {})
845
+ #
846
+ # Calls:
847
+ # JSON.parse!(File.read(path, opts))
848
+ #
849
+ # See method #parse!
850
+ #
851
+ # source://json-2.6.2/lib/json/common.rb:256
852
+ def load_file!(filespec, opts = T.unsafe(nil))
853
+ ;
854
+ end
855
+
856
+ # :call-seq:
857
+ # JSON.parse(source, opts) -> object
858
+ #
859
+ # Returns the Ruby objects created by parsing the given +source+.
860
+ #
861
+ # Argument +source+ contains the \String to be parsed.
862
+ #
863
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
864
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
865
+ #
866
+ # ---
867
+ #
868
+ # When +source+ is a \JSON array, returns a Ruby \Array:
869
+ # source = '["foo", 1.0, true, false, null]'
870
+ # ruby = JSON.parse(source)
871
+ # ruby # => ["foo", 1.0, true, false, nil]
872
+ # ruby.class # => Array
873
+ #
874
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
875
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
876
+ # ruby = JSON.parse(source)
877
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
878
+ # ruby.class # => Hash
879
+ #
880
+ # For examples of parsing for all \JSON data types, see
881
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
882
+ #
883
+ # Parses nested JSON objects:
884
+ # source = <<-EOT
885
+ # {
886
+ # "name": "Dave",
887
+ # "age" :40,
888
+ # "hats": [
889
+ # "Cattleman's",
890
+ # "Panama",
891
+ # "Tophat"
892
+ # ]
893
+ # }
894
+ # EOT
895
+ # ruby = JSON.parse(source)
896
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
897
+ #
898
+ # ---
899
+ #
900
+ # Raises an exception if +source+ is not valid JSON:
901
+ # # Raises JSON::ParserError (783: unexpected token at ''):
902
+ # JSON.parse('')
903
+ #
904
+ # source://json-2.6.2/lib/json/common.rb:215
905
+ def parse(source, opts = T.unsafe(nil))
906
+ ;
907
+ end
908
+
909
+ # :call-seq:
910
+ # JSON.parse!(source, opts) -> object
911
+ #
912
+ # Calls
913
+ # parse(source, opts)
914
+ # with +source+ and possibly modified +opts+.
915
+ #
916
+ # Differences from JSON.parse:
917
+ # - Option +max_nesting+, if not provided, defaults to +false+,
918
+ # which disables checking for nesting depth.
919
+ # - Option +allow_nan+, if not provided, defaults to +true+.
920
+ #
921
+ # source://json-2.6.2/lib/json/common.rb:230
922
+ def parse!(source, opts = T.unsafe(nil))
923
+ ;
924
+ end
925
+
926
+ # :call-seq:
927
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
928
+ #
929
+ # Arguments +obj+ and +opts+ here are the same as
930
+ # arguments +obj+ and +opts+ in JSON.generate.
931
+ #
932
+ # Default options are:
933
+ # {
934
+ # indent: ' ', # Two spaces
935
+ # space: ' ', # One space
936
+ # array_nl: "\n", # Newline
937
+ # object_nl: "\n" # Newline
938
+ # }
939
+ #
940
+ # Example:
941
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
942
+ # json = JSON.pretty_generate(obj)
943
+ # puts json
944
+ # Output:
945
+ # {
946
+ # "foo": [
947
+ # "bar",
948
+ # "baz"
949
+ # ],
950
+ # "bat": {
951
+ # "bam": 0,
952
+ # "bad": 1
953
+ # }
954
+ # }
955
+ #
956
+ # source://json-2.6.2/lib/json/common.rb:390
957
+ def pretty_generate(obj, opts = T.unsafe(nil))
958
+ ;
959
+ end
960
+
961
+ # :stopdoc:
962
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
963
+ #
964
+ # source://json-2.6.2/lib/json/common.rb:390
965
+ def pretty_unparse(obj, opts = T.unsafe(nil))
966
+ ;
967
+ end
968
+
969
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
970
+ #
971
+ # source://json-2.6.2/lib/json/common.rb:575
972
+ def recurse_proc(result, &proc)
973
+ ;
974
+ end
975
+
976
+ # source://json-2.6.2/lib/json/common.rb:557
977
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil))
978
+ ;
979
+ end
980
+
981
+ # :stopdoc:
982
+ # I want to deprecate these later, so I'll first be silent about them, and
983
+ # later delete them.
984
+ #
985
+ # source://json-2.6.2/lib/json/common.rb:296
986
+ def unparse(obj, opts = T.unsafe(nil))
987
+ ;
988
+ end
989
+
990
+ class << self
991
+ # :call-seq:
992
+ # JSON[object] -> new_array or new_string
993
+ #
994
+ # If +object+ is a \String,
995
+ # calls JSON.parse with +object+ and +opts+ (see method #parse):
996
+ # json = '[0, 1, null]'
997
+ # JSON[json]# => [0, 1, nil]
998
+ #
999
+ # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate):
1000
+ # ruby = [0, 1, nil]
1001
+ # JSON[ruby] # => '[0,1,null]'
1002
+ #
1003
+ # source://json-2.6.2/lib/json/common.rb:18
1004
+ def [](object, opts = T.unsafe(nil))
1005
+ ;
1006
+ end
1007
+
1008
+ # source://json-2.6.2/lib/json/common.rb:81
1009
+ def create_fast_state; end
1010
+
1011
+ # Returns the current create identifier.
1012
+ # See also JSON.create_id=.
1013
+ #
1014
+ # source://json-2.6.2/lib/json/common.rb:126
1015
+ def create_id; end
1016
+
1017
+ # Sets create identifier, which is used to decide if the _json_create_
1018
+ # hook of a class should be called; initial value is +json_class+:
1019
+ # JSON.create_id # => 'json_class'
1020
+ #
1021
+ # source://json-2.6.2/lib/json/common.rb:120
1022
+ def create_id=(new_value)
1023
+ ;
1024
+ end
1025
+
1026
+ # source://json-2.6.2/lib/json/common.rb:91
1027
+ def create_pretty_state; end
1028
+
1029
+ # Return the constant located at _path_. The format of _path_ has to be
1030
+ # either ::A::B::C or A::B::C. In any case, A has to be located at the top
1031
+ # level (absolute namespace path?). If there doesn't exist a constant at
1032
+ # the given path, an ArgumentError is raised.
1033
+ #
1034
+ # source://json-2.6.2/lib/json/common.rb:42
1035
+ def deep_const_get(path)
1036
+ ;
1037
+ end
1038
+
1039
+ # :call-seq:
1040
+ # JSON.dump(obj, io = nil, limit = nil)
1041
+ #
1042
+ # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
1043
+ #
1044
+ # The default options can be changed via method JSON.dump_default_options.
1045
+ #
1046
+ # - Argument +io+, if given, should respond to method +write+;
1047
+ # the \JSON \String is written to +io+, and +io+ is returned.
1048
+ # If +io+ is not given, the \JSON \String is returned.
1049
+ # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+.
1050
+ #
1051
+ # ---
1052
+ #
1053
+ # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
1054
+ # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad}
1055
+ # json = JSON.dump(obj)
1056
+ # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}"
1057
+ #
1058
+ # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+:
1059
+ # path = 't.json'
1060
+ # File.open(path, 'w') do |file|
1061
+ # JSON.dump(obj, file)
1062
+ # end # => #<File:t.json (closed)>
1063
+ # puts File.read(path)
1064
+ # Output:
1065
+ # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
1066
+ #
1067
+ # source://json-2.6.2/lib/json/common.rb:631
1068
+ def dump(obj, anIO = T.unsafe(nil), limit = T.unsafe(nil))
1069
+ ;
1070
+ end
1071
+
1072
+ # Sets or returns the default options for the JSON.dump method.
1073
+ # Initially:
1074
+ # opts = JSON.dump_default_options
1075
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1076
+ #
1077
+ # source://json-2.6.2/lib/json/common.rb:596
1078
+ def dump_default_options; end
1079
+
1080
+ # Sets or returns the default options for the JSON.dump method.
1081
+ # Initially:
1082
+ # opts = JSON.dump_default_options
1083
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
1084
+ #
1085
+ # source://json-2.6.2/lib/json/common.rb:596
1086
+ def dump_default_options=(_arg0)
1087
+ ;
1088
+ end
1089
+
1090
+ # :call-seq:
1091
+ # JSON.fast_generate(obj, opts) -> new_string
1092
+ #
1093
+ # Arguments +obj+ and +opts+ here are the same as
1094
+ # arguments +obj+ and +opts+ in JSON.generate.
1095
+ #
1096
+ # By default, generates \JSON data without checking
1097
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
1098
+ #
1099
+ # Raises an exception if +obj+ contains circular references:
1100
+ # a = []; b = []; a.push(b); b.push(a)
1101
+ # # Raises SystemStackError (stack level too deep):
1102
+ # JSON.fast_generate(a)
1103
+ #
1104
+ # source://json-2.6.2/lib/json/common.rb:335
1105
+ def fast_generate(obj, opts = T.unsafe(nil))
1106
+ ;
1107
+ end
1108
+
1109
+ # :stopdoc:
1110
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1111
+ #
1112
+ # source://json-2.6.2/lib/json/common.rb:335
1113
+ def fast_unparse(obj, opts = T.unsafe(nil))
1114
+ ;
1115
+ end
1116
+
1117
+ # :call-seq:
1118
+ # JSON.generate(obj, opts = nil) -> new_string
1119
+ #
1120
+ # Returns a \String containing the generated \JSON data.
1121
+ #
1122
+ # See also JSON.fast_generate, JSON.pretty_generate.
1123
+ #
1124
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
1125
+ #
1126
+ # Argument +opts+, if given, contains a \Hash of options for the generation.
1127
+ # See {Generating Options}[#module-JSON-label-Generating+Options].
1128
+ #
1129
+ # ---
1130
+ #
1131
+ # When +obj+ is an \Array, returns a \String containing a \JSON array:
1132
+ # obj = ["foo", 1.0, true, false, nil]
1133
+ # json = JSON.generate(obj)
1134
+ # json # => '["foo",1.0,true,false,null]'
1135
+ #
1136
+ # When +obj+ is a \Hash, returns a \String containing a \JSON object:
1137
+ # obj = {foo: 0, bar: 's', baz: :bat}
1138
+ # json = JSON.generate(obj)
1139
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
1140
+ #
1141
+ # For examples of generating from other Ruby objects, see
1142
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
1143
+ #
1144
+ # ---
1145
+ #
1146
+ # Raises an exception if any formatting option is not a \String.
1147
+ #
1148
+ # Raises an exception if +obj+ contains circular references:
1149
+ # a = []; b = []; a.push(b); b.push(a)
1150
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
1151
+ # JSON.generate(a)
1152
+ #
1153
+ # source://json-2.6.2/lib/json/common.rb:296
1154
+ def generate(obj, opts = T.unsafe(nil))
1155
+ ;
1156
+ end
1157
+
1158
+ # Returns the JSON generator module that is used by JSON. This is
1159
+ # either JSON::Ext::Generator or JSON::Pure::Generator:
1160
+ # JSON.generator # => JSON::Ext::Generator
1161
+ #
1162
+ # source://json-2.6.2/lib/json/common.rb:103
1163
+ def generator; end
1164
+
1165
+ # Set the module _generator_ to be used by JSON.
1166
+ #
1167
+ # source://json-2.6.2/lib/json/common.rb:58
1168
+ def generator=(generator)
1169
+ ;
1170
+ end
1171
+
1172
+ # Encodes string using String.encode.
1173
+ #
1174
+ # source://json-2.6.2/lib/json/common.rb:653
1175
+ def iconv(to, from, string)
1176
+ ;
1177
+ end
1178
+
1179
+ # :call-seq:
1180
+ # JSON.load(source, proc = nil, options = {}) -> object
1181
+ #
1182
+ # Returns the Ruby objects created by parsing the given +source+.
1183
+ #
1184
+ # - Argument +source+ must be, or be convertible to, a \String:
1185
+ # - If +source+ responds to instance method +to_str+,
1186
+ # <tt>source.to_str</tt> becomes the source.
1187
+ # - If +source+ responds to instance method +to_io+,
1188
+ # <tt>source.to_io.read</tt> becomes the source.
1189
+ # - If +source+ responds to instance method +read+,
1190
+ # <tt>source.read</tt> becomes the source.
1191
+ # - If both of the following are true, source becomes the \String <tt>'null'</tt>:
1192
+ # - Option +allow_blank+ specifies a truthy value.
1193
+ # - The source, as defined above, is +nil+ or the empty \String <tt>''</tt>.
1194
+ # - Otherwise, +source+ remains the source.
1195
+ # - Argument +proc+, if given, must be a \Proc that accepts one argument.
1196
+ # It will be called recursively with each result (depth-first order).
1197
+ # See details below.
1198
+ # BEWARE: This method is meant to serialise data from trusted user input,
1199
+ # like from your own database server or clients under your control, it could
1200
+ # be dangerous to allow untrusted users to pass JSON sources into it.
1201
+ # - Argument +opts+, if given, contains a \Hash of options for the parsing.
1202
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1203
+ # The default options can be changed via method JSON.load_default_options=.
1204
+ #
1205
+ # ---
1206
+ #
1207
+ # When no +proc+ is given, modifies +source+ as above and returns the result of
1208
+ # <tt>parse(source, opts)</tt>; see #parse.
1209
+ #
1210
+ # Source for following examples:
1211
+ # source = <<-EOT
1212
+ # {
1213
+ # "name": "Dave",
1214
+ # "age" :40,
1215
+ # "hats": [
1216
+ # "Cattleman's",
1217
+ # "Panama",
1218
+ # "Tophat"
1219
+ # ]
1220
+ # }
1221
+ # EOT
1222
+ #
1223
+ # Load a \String:
1224
+ # ruby = JSON.load(source)
1225
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1226
+ #
1227
+ # Load an \IO object:
1228
+ # require 'stringio'
1229
+ # object = JSON.load(StringIO.new(source))
1230
+ # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1231
+ #
1232
+ # Load a \File object:
1233
+ # path = 't.json'
1234
+ # File.write(path, source)
1235
+ # File.open(path) do |file|
1236
+ # JSON.load(file)
1237
+ # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1238
+ #
1239
+ # ---
1240
+ #
1241
+ # When +proc+ is given:
1242
+ # - Modifies +source+ as above.
1243
+ # - Gets the +result+ from calling <tt>parse(source, opts)</tt>.
1244
+ # - Recursively calls <tt>proc(result)</tt>.
1245
+ # - Returns the final result.
1246
+ #
1247
+ # Example:
1248
+ # require 'json'
1249
+ #
1250
+ # # Some classes for the example.
1251
+ # class Base
1252
+ # def initialize(attributes)
1253
+ # @attributes = attributes
1254
+ # end
1255
+ # end
1256
+ # class User < Base; end
1257
+ # class Account < Base; end
1258
+ # class Admin < Base; end
1259
+ # # The JSON source.
1260
+ # json = <<-EOF
1261
+ # {
1262
+ # "users": [
1263
+ # {"type": "User", "username": "jane", "email": "jane@example.com"},
1264
+ # {"type": "User", "username": "john", "email": "john@example.com"}
1265
+ # ],
1266
+ # "accounts": [
1267
+ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}},
1268
+ # {"account": {"type": "Account", "paid": false, "account_id": "1235"}}
1269
+ # ],
1270
+ # "admins": {"type": "Admin", "password": "0wn3d"}
1271
+ # }
1272
+ # EOF
1273
+ # # Deserializer method.
1274
+ # def deserialize_obj(obj, safe_types = %w(User Account Admin))
1275
+ # type = obj.is_a?(Hash) && obj["type"]
1276
+ # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj
1277
+ # end
1278
+ # # Call to JSON.load
1279
+ # ruby = JSON.load(json, proc {|obj|
1280
+ # case obj
1281
+ # when Hash
1282
+ # obj.each {|k, v| obj[k] = deserialize_obj v }
1283
+ # when Array
1284
+ # obj.map! {|v| deserialize_obj v }
1285
+ # end
1286
+ # })
1287
+ # pp ruby
1288
+ # Output:
1289
+ # {"users"=>
1290
+ # [#<User:0x00000000064c4c98
1291
+ # @attributes=
1292
+ # {"type"=>"User", "username"=>"jane", "email"=>"jane@example.com"}>,
1293
+ # #<User:0x00000000064c4bd0
1294
+ # @attributes=
1295
+ # {"type"=>"User", "username"=>"john", "email"=>"john@example.com"}>],
1296
+ # "accounts"=>
1297
+ # [{"account"=>
1298
+ # #<Account:0x00000000064c4928
1299
+ # @attributes={"type"=>"Account", "paid"=>true, "account_id"=>"1234"}>},
1300
+ # {"account"=>
1301
+ # #<Account:0x00000000064c4680
1302
+ # @attributes={"type"=>"Account", "paid"=>false, "account_id"=>"1235"}>}],
1303
+ # "admins"=>
1304
+ # #<Admin:0x00000000064c41f8
1305
+ # @attributes={"type"=>"Admin", "password"=>"0wn3d"}>}
1306
+ #
1307
+ # source://json-2.6.2/lib/json/common.rb:557
1308
+ def load(source, proc = T.unsafe(nil), options = T.unsafe(nil))
1309
+ ;
1310
+ end
1311
+
1312
+ # Sets or returns default options for the JSON.load method.
1313
+ # Initially:
1314
+ # opts = JSON.load_default_options
1315
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1316
+ #
1317
+ # source://json-2.6.2/lib/json/common.rb:420
1318
+ def load_default_options; end
1319
+
1320
+ # Sets or returns default options for the JSON.load method.
1321
+ # Initially:
1322
+ # opts = JSON.load_default_options
1323
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
1324
+ #
1325
+ # source://json-2.6.2/lib/json/common.rb:420
1326
+ def load_default_options=(_arg0)
1327
+ ;
1328
+ end
1329
+
1330
+ # :call-seq:
1331
+ # JSON.load_file(path, opts={}) -> object
1332
+ #
1333
+ # Calls:
1334
+ # parse(File.read(path), opts)
1335
+ #
1336
+ # See method #parse.
1337
+ #
1338
+ # source://json-2.6.2/lib/json/common.rb:245
1339
+ def load_file(filespec, opts = T.unsafe(nil))
1340
+ ;
1341
+ end
1342
+
1343
+ # :call-seq:
1344
+ # JSON.load_file!(path, opts = {})
1345
+ #
1346
+ # Calls:
1347
+ # JSON.parse!(File.read(path, opts))
1348
+ #
1349
+ # See method #parse!
1350
+ #
1351
+ # source://json-2.6.2/lib/json/common.rb:256
1352
+ def load_file!(filespec, opts = T.unsafe(nil))
1353
+ ;
1354
+ end
1355
+
1356
+ # :call-seq:
1357
+ # JSON.parse(source, opts) -> object
1358
+ #
1359
+ # Returns the Ruby objects created by parsing the given +source+.
1360
+ #
1361
+ # Argument +source+ contains the \String to be parsed.
1362
+ #
1363
+ # Argument +opts+, if given, contains a \Hash of options for the parsing.
1364
+ # See {Parsing Options}[#module-JSON-label-Parsing+Options].
1365
+ #
1366
+ # ---
1367
+ #
1368
+ # When +source+ is a \JSON array, returns a Ruby \Array:
1369
+ # source = '["foo", 1.0, true, false, null]'
1370
+ # ruby = JSON.parse(source)
1371
+ # ruby # => ["foo", 1.0, true, false, nil]
1372
+ # ruby.class # => Array
1373
+ #
1374
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
1375
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
1376
+ # ruby = JSON.parse(source)
1377
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
1378
+ # ruby.class # => Hash
1379
+ #
1380
+ # For examples of parsing for all \JSON data types, see
1381
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
1382
+ #
1383
+ # Parses nested JSON objects:
1384
+ # source = <<-EOT
1385
+ # {
1386
+ # "name": "Dave",
1387
+ # "age" :40,
1388
+ # "hats": [
1389
+ # "Cattleman's",
1390
+ # "Panama",
1391
+ # "Tophat"
1392
+ # ]
1393
+ # }
1394
+ # EOT
1395
+ # ruby = JSON.parse(source)
1396
+ # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
1397
+ #
1398
+ # ---
1399
+ #
1400
+ # Raises an exception if +source+ is not valid JSON:
1401
+ # # Raises JSON::ParserError (783: unexpected token at ''):
1402
+ # JSON.parse('')
1403
+ #
1404
+ # source://json-2.6.2/lib/json/common.rb:215
1405
+ def parse(source, opts = T.unsafe(nil))
1406
+ ;
1407
+ end
1408
+
1409
+ # :call-seq:
1410
+ # JSON.parse!(source, opts) -> object
1411
+ #
1412
+ # Calls
1413
+ # parse(source, opts)
1414
+ # with +source+ and possibly modified +opts+.
1415
+ #
1416
+ # Differences from JSON.parse:
1417
+ # - Option +max_nesting+, if not provided, defaults to +false+,
1418
+ # which disables checking for nesting depth.
1419
+ # - Option +allow_nan+, if not provided, defaults to +true+.
1420
+ #
1421
+ # source://json-2.6.2/lib/json/common.rb:230
1422
+ def parse!(source, opts = T.unsafe(nil))
1423
+ ;
1424
+ end
1425
+
1426
+ # Returns the JSON parser class that is used by JSON. This is either
1427
+ # JSON::Ext::Parser or JSON::Pure::Parser:
1428
+ # JSON.parser # => JSON::Ext::Parser
1429
+ #
1430
+ # source://json-2.6.2/lib/json/common.rb:29
1431
+ def parser; end
1432
+
1433
+ # Set the JSON parser class _parser_ to be used by JSON.
1434
+ #
1435
+ # source://json-2.6.2/lib/json/common.rb:32
1436
+ def parser=(parser)
1437
+ ;
1438
+ end
1439
+
1440
+ # :call-seq:
1441
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
1442
+ #
1443
+ # Arguments +obj+ and +opts+ here are the same as
1444
+ # arguments +obj+ and +opts+ in JSON.generate.
1445
+ #
1446
+ # Default options are:
1447
+ # {
1448
+ # indent: ' ', # Two spaces
1449
+ # space: ' ', # One space
1450
+ # array_nl: "\n", # Newline
1451
+ # object_nl: "\n" # Newline
1452
+ # }
1453
+ #
1454
+ # Example:
1455
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
1456
+ # json = JSON.pretty_generate(obj)
1457
+ # puts json
1458
+ # Output:
1459
+ # {
1460
+ # "foo": [
1461
+ # "bar",
1462
+ # "baz"
1463
+ # ],
1464
+ # "bat": {
1465
+ # "bam": 0,
1466
+ # "bad": 1
1467
+ # }
1468
+ # }
1469
+ #
1470
+ # source://json-2.6.2/lib/json/common.rb:390
1471
+ def pretty_generate(obj, opts = T.unsafe(nil))
1472
+ ;
1473
+ end
1474
+
1475
+ # :stopdoc:
1476
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
1477
+ #
1478
+ # source://json-2.6.2/lib/json/common.rb:390
1479
+ def pretty_unparse(obj, opts = T.unsafe(nil))
1480
+ ;
1481
+ end
1482
+
1483
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
1484
+ #
1485
+ # source://json-2.6.2/lib/json/common.rb:575
1486
+ def recurse_proc(result, &proc)
1487
+ ;
1488
+ end
1489
+
1490
+ # source://json-2.6.2/lib/json/common.rb:557
1491
+ def restore(source, proc = T.unsafe(nil), options = T.unsafe(nil))
1492
+ ;
1493
+ end
1494
+
1495
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1496
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1497
+ # JSON.state # => JSON::Ext::Generator::State
1498
+ #
1499
+ # source://json-2.6.2/lib/json/common.rb:108
1500
+ def state; end
1501
+
1502
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
1503
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
1504
+ # JSON.state # => JSON::Ext::Generator::State
1505
+ #
1506
+ # source://json-2.6.2/lib/json/common.rb:108
1507
+ def state=(_arg0)
1508
+ ;
1509
+ end
1510
+
1511
+ # :stopdoc:
1512
+ # I want to deprecate these later, so I'll first be silent about them, and
1513
+ # later delete them.
1514
+ #
1515
+ # source://json-2.6.2/lib/json/common.rb:296
1516
+ def unparse(obj, opts = T.unsafe(nil))
1517
+ ;
1518
+ end
1519
+ end
1520
+ end
1521
+
1522
+ # source://json-2.6.2/lib/json/common.rb:114
1523
+ JSON::CREATE_ID_TLS_KEY = T.let(T.unsafe(nil), String)
1524
+
1525
+ # source://json-2.6.2/lib/json/common.rb:111
1526
+ JSON::DEFAULT_CREATE_ID = T.let(T.unsafe(nil), String)
1527
+
1528
+ # source://json-2.6.2/lib/json/generic_object.rb:5
1529
+ class JSON::GenericObject < ::OpenStruct
1530
+ # source://json-2.6.2/lib/json/generic_object.rb:63
1531
+ def as_json(*_arg0)
1532
+ ;
1533
+ end
1534
+
1535
+ # source://json-2.6.2/lib/json/generic_object.rb:47
1536
+ def to_hash; end
1537
+
1538
+ # source://json-2.6.2/lib/json/generic_object.rb:67
1539
+ def to_json(*a)
1540
+ ;
1541
+ end
1542
+
1543
+ # source://json-2.6.2/lib/json/generic_object.rb:59
1544
+ def |(other)
1545
+ ;
1546
+ end
1547
+
1548
+ class << self
1549
+ # source://json-2.6.2/lib/json/generic_object.rb:41
1550
+ def dump(obj, *args)
1551
+ ;
1552
+ end
1553
+
1554
+ # source://json-2.6.2/lib/json/generic_object.rb:21
1555
+ def from_hash(object)
1556
+ ;
1557
+ end
1558
+
1559
+ # Sets the attribute json_creatable
1560
+ #
1561
+ # @param value the value to set the attribute json_creatable to.
1562
+ #
1563
+ # source://json-2.6.2/lib/json/generic_object.rb:13
1564
+ def json_creatable=(_arg0)
1565
+ ;
1566
+ end
1567
+
1568
+ # @return [Boolean]
1569
+ #
1570
+ # source://json-2.6.2/lib/json/generic_object.rb:9
1571
+ def json_creatable?; end
1572
+
1573
+ # source://json-2.6.2/lib/json/generic_object.rb:15
1574
+ def json_create(data)
1575
+ ;
1576
+ end
1577
+
1578
+ # source://json-2.6.2/lib/json/generic_object.rb:36
1579
+ def load(source, proc = T.unsafe(nil), opts = T.unsafe(nil))
1580
+ ;
1581
+ end
1582
+ end
1583
+ end
1584
+
1585
+ # The base exception for JSON errors.
1586
+ #
1587
+ # source://json-2.6.2/lib/json/common.rb:137
1588
+ class JSON::JSONError < ::StandardError
1589
+ class << self
1590
+ # source://json-2.6.2/lib/json/common.rb:138
1591
+ def wrap(exception)
1592
+ ;
1593
+ end
1594
+ end
1595
+ end
1596
+
1597
+ # source://json-2.6.2/lib/json/common.rb:35
1598
+ JSON::Parser = JSON::Ext::Parser
1599
+
1600
+ # source://json-2.6.2/lib/json/common.rb:73
1601
+ JSON::State = JSON::Ext::Generator::State
1602
+
1603
+ # For backwards compatibility
1604
+ #
1605
+ # source://json-2.6.2/lib/json/common.rb:159
1606
+ JSON::UnparserError = JSON::GeneratorError
1607
+
1608
+ # source://json-2.6.2/lib/json/common.rb:658
1609
+ module Kernel
1610
+ private
1611
+
1612
+ # If _object_ is string-like, parse the string and return the parsed result as
1613
+ # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
1614
+ # structure object and return it.
1615
+ #
1616
+ # The _opts_ argument is passed through to generate/parse respectively. See
1617
+ # generate and parse for their documentation.
1618
+ #
1619
+ # source://json-2.6.2/lib/json/common.rb:685
1620
+ def JSON(object, *args)
1621
+ ;
1622
+ end
1623
+
1624
+ # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
1625
+ # one line.
1626
+ #
1627
+ # source://json-2.6.2/lib/json/common.rb:663
1628
+ def j(*objs)
1629
+ ;
1630
+ end
1631
+
1632
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
1633
+ # indentation and over many lines.
1634
+ #
1635
+ # source://json-2.6.2/lib/json/common.rb:672
1636
+ def jj(*objs)
1637
+ ;
1638
+ end
1639
+ end
1640
+
1641
+ class Set
1642
+ include ::Enumerable
1643
+ end
1644
+
1645
+ # source://RUBY_ROOT/set.rb:815
1646
+ Set::InspectKey = T.let(T.unsafe(nil), Symbol)
1647
+
1648
+ class Symbol
1649
+ include ::Comparable
1650
+ end