shopify-ruby-definitions 0.0.1 → 1.1.0

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