ruby-paseto 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/CODE_OF_CONDUCT.md +84 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +549 -0
  6. data/lib/paseto/asn1/algorithm_identifier.rb +17 -0
  7. data/lib/paseto/asn1/curve_private_key.rb +22 -0
  8. data/lib/paseto/asn1/ec_private_key.rb +27 -0
  9. data/lib/paseto/asn1/ecdsa_full_r.rb +26 -0
  10. data/lib/paseto/asn1/ecdsa_sig_value.rb +23 -0
  11. data/lib/paseto/asn1/ecdsa_signature.rb +49 -0
  12. data/lib/paseto/asn1/ed25519_identifier.rb +15 -0
  13. data/lib/paseto/asn1/named_curve.rb +17 -0
  14. data/lib/paseto/asn1/one_asymmetric_key.rb +32 -0
  15. data/lib/paseto/asn1/private_key.rb +17 -0
  16. data/lib/paseto/asn1/private_key_algorithm_identifier.rb +17 -0
  17. data/lib/paseto/asn1/public_key.rb +17 -0
  18. data/lib/paseto/asn1/subject_public_key_info.rb +28 -0
  19. data/lib/paseto/asn1.rb +101 -0
  20. data/lib/paseto/asymmetric_key.rb +100 -0
  21. data/lib/paseto/configuration/box.rb +23 -0
  22. data/lib/paseto/configuration/decode_configuration.rb +68 -0
  23. data/lib/paseto/configuration.rb +18 -0
  24. data/lib/paseto/interface/i_d.rb +23 -0
  25. data/lib/paseto/interface/key.rb +113 -0
  26. data/lib/paseto/interface/pbkd.rb +83 -0
  27. data/lib/paseto/interface/pie.rb +59 -0
  28. data/lib/paseto/interface/pke.rb +86 -0
  29. data/lib/paseto/interface/serializer.rb +19 -0
  30. data/lib/paseto/interface/version.rb +161 -0
  31. data/lib/paseto/interface/wrapper.rb +20 -0
  32. data/lib/paseto/operations/i_d.rb +48 -0
  33. data/lib/paseto/operations/id/i_dv3.rb +20 -0
  34. data/lib/paseto/operations/id/i_dv4.rb +20 -0
  35. data/lib/paseto/operations/pbkd/p_b_k_dv3.rb +85 -0
  36. data/lib/paseto/operations/pbkd/p_b_k_dv4.rb +94 -0
  37. data/lib/paseto/operations/pbkw.rb +73 -0
  38. data/lib/paseto/operations/pke/p_k_ev3.rb +97 -0
  39. data/lib/paseto/operations/pke/p_k_ev4.rb +95 -0
  40. data/lib/paseto/operations/pke.rb +57 -0
  41. data/lib/paseto/operations/wrap.rb +29 -0
  42. data/lib/paseto/paserk.rb +55 -0
  43. data/lib/paseto/paserk_types.rb +46 -0
  44. data/lib/paseto/protocol/version3.rb +100 -0
  45. data/lib/paseto/protocol/version4.rb +99 -0
  46. data/lib/paseto/result.rb +9 -0
  47. data/lib/paseto/serializer/optional_json.rb +30 -0
  48. data/lib/paseto/serializer/raw.rb +23 -0
  49. data/lib/paseto/sodium/curve_25519.rb +46 -0
  50. data/lib/paseto/sodium/safe_ed25519_loader.rb +19 -0
  51. data/lib/paseto/sodium/stream/base.rb +82 -0
  52. data/lib/paseto/sodium/stream/x_cha_cha20_xor.rb +31 -0
  53. data/lib/paseto/sodium.rb +5 -0
  54. data/lib/paseto/symmetric_key.rb +119 -0
  55. data/lib/paseto/token.rb +127 -0
  56. data/lib/paseto/token_types.rb +29 -0
  57. data/lib/paseto/util.rb +105 -0
  58. data/lib/paseto/v3/local.rb +63 -0
  59. data/lib/paseto/v3/public.rb +204 -0
  60. data/lib/paseto/v4/local.rb +56 -0
  61. data/lib/paseto/v4/public.rb +169 -0
  62. data/lib/paseto/validator.rb +154 -0
  63. data/lib/paseto/verifiers/footer.rb +30 -0
  64. data/lib/paseto/verifiers/payload.rb +42 -0
  65. data/lib/paseto/verify.rb +48 -0
  66. data/lib/paseto/version.rb +6 -0
  67. data/lib/paseto/versions.rb +25 -0
  68. data/lib/paseto/wrappers/pie/pie_v3.rb +72 -0
  69. data/lib/paseto/wrappers/pie/pie_v4.rb +72 -0
  70. data/lib/paseto/wrappers/pie.rb +71 -0
  71. data/lib/paseto.rb +99 -0
  72. data/paseto.gemspec +58 -0
  73. data/sorbet/config +3 -0
  74. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  75. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  76. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  77. data/sorbet/rbi/gems/docile@1.4.0.rbi +376 -0
  78. data/sorbet/rbi/gems/ffi@1.15.5.rbi +1994 -0
  79. data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
  80. data/sorbet/rbi/gems/irb@1.5.1.rbi +342 -0
  81. data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
  82. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +267 -0
  83. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  84. data/sorbet/rbi/gems/oj@3.13.23.rbi +603 -0
  85. data/sorbet/rbi/gems/openssl@3.0.1.rbi +1735 -0
  86. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  87. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +407 -0
  88. data/sorbet/rbi/gems/rake@13.0.6.rbi +3021 -0
  89. data/sorbet/rbi/gems/rbnacl@7.1.1.rbi +3218 -0
  90. data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +3481 -0
  91. data/sorbet/rbi/gems/reline@0.3.1.rbi +8 -0
  92. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
  93. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10887 -0
  94. data/sorbet/rbi/gems/rspec-expectations@3.12.0.rbi +8090 -0
  95. data/sorbet/rbi/gems/rspec-mocks@3.12.0.rbi +5300 -0
  96. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
  97. data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
  98. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1239 -0
  99. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +219 -0
  100. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +2135 -0
  101. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
  102. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  103. data/sorbet/rbi/gems/timecop@0.9.6.rbi +350 -0
  104. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +48 -0
  105. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2555 -0
  106. data/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +391 -0
  107. data/sorbet/rbi/gems/yard@0.9.28.rbi +17816 -0
  108. data/sorbet/rbi/gems/zeitwerk@2.6.6.rbi +950 -0
  109. data/sorbet/rbi/shims/multi_json.rbi +19 -0
  110. data/sorbet/rbi/shims/openssl.rbi +111 -0
  111. data/sorbet/rbi/shims/rbnacl.rbi +65 -0
  112. data/sorbet/rbi/shims/zeitwerk.rbi +6 -0
  113. data/sorbet/rbi/todo.rbi +7 -0
  114. data/sorbet/tapioca/config.yml +30 -0
  115. data/sorbet/tapioca/require.rb +12 -0
  116. metadata +376 -0
@@ -0,0 +1,603 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `oj` gem.
5
+ # Please instead update this file by running `bin/tapioca gem oj`.
6
+
7
+ # source://json/2.6.3/lib/json/common.rb#35
8
+ JSON::Parser = JSON::Ext::Parser
9
+
10
+ # source://json/2.6.3/lib/json/common.rb#73
11
+ JSON::State = JSON::Ext::Generator::State
12
+
13
+ # source://oj//lib/oj.rb#2
14
+ module Oj
15
+ private
16
+
17
+ def add_to_json(*_arg0); end
18
+ def compat_load(*_arg0); end
19
+ def debug_odd(_arg0); end
20
+ def default_options; end
21
+ def default_options=(_arg0); end
22
+ def dump(*_arg0); end
23
+ def fast_generate(*_arg0); end
24
+ def generate(*_arg0); end
25
+ def load(*_arg0); end
26
+ def load_file(*_arg0); end
27
+ def mimic_JSON(*_arg0); end
28
+ def object_load(*_arg0); end
29
+ def optimize_rails; end
30
+ def register_odd(*_arg0); end
31
+ def register_odd_raw(*_arg0); end
32
+ def remove_to_json(*_arg0); end
33
+ def safe_load(_arg0); end
34
+ def saj_parse(*_arg0); end
35
+ def sc_parse(*_arg0); end
36
+ def strict_load(*_arg0); end
37
+ def to_file(*_arg0); end
38
+ def to_json(*_arg0); end
39
+ def to_stream(*_arg0); end
40
+ def wab_load(*_arg0); end
41
+
42
+ class << self
43
+ def add_to_json(*_arg0); end
44
+ def compat_load(*_arg0); end
45
+ def debug_odd(_arg0); end
46
+ def default_options; end
47
+ def default_options=(_arg0); end
48
+ def dump(*_arg0); end
49
+ def fast_generate(*_arg0); end
50
+ def generate(*_arg0); end
51
+ def load(*_arg0); end
52
+ def load_file(*_arg0); end
53
+ def mimic_JSON(*_arg0); end
54
+
55
+ # Loads mimic-ed JSON paths. Used by Oj.mimic_JSON().
56
+ #
57
+ # @param mimic_paths [Array] additional paths to add to the Ruby loaded features.
58
+ #
59
+ # source://oj//lib/oj/mimic.rb#81
60
+ def mimic_loaded(mimic_paths = T.unsafe(nil)); end
61
+
62
+ def object_load(*_arg0); end
63
+ def optimize_rails; end
64
+ def register_odd(*_arg0); end
65
+ def register_odd_raw(*_arg0); end
66
+ def remove_to_json(*_arg0); end
67
+ def safe_load(_arg0); end
68
+ def saj_parse(*_arg0); end
69
+ def sc_parse(*_arg0); end
70
+ def strict_load(*_arg0); end
71
+ def to_file(*_arg0); end
72
+ def to_json(*_arg0); end
73
+ def to_stream(*_arg0); end
74
+ def wab_load(*_arg0); end
75
+ end
76
+ end
77
+
78
+ # A generic class that is used only for storing attributes. It is the base
79
+ # Class for auto-generated classes in the storage system. Instance variables
80
+ # are added using the instance_variable_set() method. All instance variables
81
+ # can be accessed using the variable name (without the @ prefix). No setters
82
+ # are provided as the Class is intended for reading only.
83
+ #
84
+ # source://oj//lib/oj/bag.rb#10
85
+ class Oj::Bag
86
+ # The initializer can take multiple arguments in the form of key values
87
+ # where the key is the variable name and the value is the variable
88
+ # value. This is intended for testing purposes only.
89
+ #
90
+ # @example Oj::Bag.new(:@x => 42, :@y => 57)
91
+ # @param args [Hash] instance variable symbols and their values
92
+ # @return [Bag] a new instance of Bag
93
+ #
94
+ # source://oj//lib/oj/bag.rb#17
95
+ def initialize(args = T.unsafe(nil)); end
96
+
97
+ # Replaces eql?() with something more reasonable for this Class.
98
+ #
99
+ # @param other [Object] Object to compare self to
100
+ # @return [Boolean] true if each variable and value are the same, otherwise false.
101
+ #
102
+ # source://oj//lib/oj/bag.rb#48
103
+ def ==(other); end
104
+
105
+ # Replaces eql?() with something more reasonable for this Class.
106
+ #
107
+ # @param other [Object] Object to compare self to
108
+ # @return [Boolean] true if each variable and value are the same, otherwise false.
109
+ #
110
+ # source://oj//lib/oj/bag.rb#48
111
+ def eql?(other); end
112
+
113
+ # Handles requests for variable values. Others cause an Exception to be
114
+ # raised.
115
+ #
116
+ # @param m [Symbol] method symbol
117
+ # @raise [ArgumentError] if an argument is given. Zero arguments expected.
118
+ # @raise [NoMethodError] if the instance variable is not defined.
119
+ # @return [Boolean] the value of the specified instance variable.
120
+ #
121
+ # source://oj//lib/oj/bag.rb#38
122
+ def method_missing(m, *args, &block); end
123
+
124
+ # Replaces the Object.respond_to?() method.
125
+ #
126
+ # @param m [Symbol] method symbol
127
+ # @return [Boolean] true for any method that matches an instance
128
+ # variable reader, otherwise false.
129
+ #
130
+ # source://oj//lib/oj/bag.rb#27
131
+ def respond_to?(m); end
132
+
133
+ class << self
134
+ # Define a new class based on the Oj::Bag class. This is used internally in
135
+ # the Oj module and is available to service wrappers that receive XML
136
+ # requests that include Objects of Classes not defined in the storage
137
+ # process.
138
+ #
139
+ # @param classname [String] Class name or symbol that includes Module names.
140
+ # @raise [NameError] if the classname is invalid.
141
+ # @return [Object] an instance of the specified Class.
142
+ #
143
+ # source://oj//lib/oj/bag.rb#64
144
+ def define_class(classname); end
145
+ end
146
+ end
147
+
148
+ class Oj::CStack; end
149
+
150
+ # Custom mode can be used to emulate the compat mode with some minor
151
+ # differences. These are the options that setup the custom mode to be like
152
+ # the compat mode.
153
+ #
154
+ # source://oj//lib/oj/mimic.rb#15
155
+ Oj::CUSTOM_MIMIC_JSON_OPTIONS = T.let(T.unsafe(nil), Hash)
156
+
157
+ class Oj::Cache; end
158
+
159
+ # An Exception that is raised as a result of a path being too deep.
160
+ #
161
+ # source://oj//lib/oj/error.rb#14
162
+ class Oj::DepthError < ::Oj::Error; end
163
+
164
+ class Oj::Doc
165
+ def clone; end
166
+ def close; end
167
+ def dump(*_arg0); end
168
+ def dup; end
169
+ def each_child(*_arg0); end
170
+ def each_leaf(*_arg0); end
171
+ def each_value(*_arg0); end
172
+ def exists?(_arg0); end
173
+ def fetch(*_arg0); end
174
+ def home; end
175
+ def local_key; end
176
+ def move(_arg0); end
177
+ def path; end
178
+ def size; end
179
+ def type(*_arg0); end
180
+ def where; end
181
+ def where?; end
182
+
183
+ class << self
184
+ def open(_arg0); end
185
+ def open_file(_arg0); end
186
+ def parse(_arg0); end
187
+ end
188
+ end
189
+
190
+ # A Hash subclass that normalizes the hash keys to allow lookup by the
191
+ # key.to_s or key.to_sym. It also supports looking up hash values by methods
192
+ # that match the keys.
193
+ #
194
+ # source://oj//lib/oj/easy_hash.rb#7
195
+ class Oj::EasyHash < ::Hash
196
+ # Initializes the instance to an empty Hash.
197
+ #
198
+ # @return [EasyHash] a new instance of EasyHash
199
+ #
200
+ # source://oj//lib/oj/easy_hash.rb#10
201
+ def initialize; end
202
+
203
+ # source://oj//lib/oj/easy_hash.rb#25
204
+ def [](key); end
205
+
206
+ # Handles requests for Hash values. Others cause an Exception to be raised.
207
+ #
208
+ # @param m [Symbol|String] method symbol
209
+ # @raise [ArgumentError] if an argument is given. Zero arguments expected.
210
+ # @raise [NoMethodError] if the instance variable is not defined.
211
+ # @return [Boolean] the value of the specified instance variable.
212
+ #
213
+ # source://oj//lib/oj/easy_hash.rb#36
214
+ def method_missing(m, *args, &block); end
215
+
216
+ # Replaces the Object.respond_to?() method.
217
+ #
218
+ # @param m [Symbol] method symbol
219
+ # @param include_all [Boolean] whether to include private and protected methods in the search
220
+ # @return [Boolean] true for any method that matches an instance
221
+ # variable reader, otherwise false.
222
+ #
223
+ # source://oj//lib/oj/easy_hash.rb#18
224
+ def respond_to?(m, include_all = T.unsafe(nil)); end
225
+ end
226
+
227
+ # Inherit Error class from StandardError.
228
+ #
229
+ # source://oj//lib/oj/error.rb#5
230
+ class Oj::Error < ::StandardError; end
231
+
232
+ # An Exception that is raised if a file fails to load.
233
+ #
234
+ # source://oj//lib/oj/error.rb#17
235
+ class Oj::LoadError < ::Oj::Error; end
236
+
237
+ # A bit hack-ish but does the trick. The JSON.dump_default_options is a Hash
238
+ # but in mimic we use a C struct to store defaults. This class creates a view
239
+ # onto that struct.
240
+ #
241
+ # source://oj//lib/oj/mimic.rb#60
242
+ class Oj::MimicDumpOption < ::Hash
243
+ # @return [MimicDumpOption] a new instance of MimicDumpOption
244
+ #
245
+ # source://oj//lib/oj/mimic.rb#61
246
+ def initialize; end
247
+
248
+ # source://oj//lib/oj/mimic.rb#69
249
+ def []=(key, value); end
250
+ end
251
+
252
+ # An Exception that is raised if there is a conflict with mimicking JSON
253
+ #
254
+ # source://oj//lib/oj/error.rb#20
255
+ class Oj::MimicError < ::Oj::Error; end
256
+
257
+ # An Exception that is raised as a result of a parse error while parsing a JSON document.
258
+ #
259
+ # source://oj//lib/oj/error.rb#11
260
+ class Oj::ParseError < ::Oj::Error; end
261
+
262
+ class Oj::Parser
263
+ def file(_arg0); end
264
+ def just_one; end
265
+ def just_one=(_arg0); end
266
+ def load(_arg0); end
267
+ def method_missing(*_arg0); end
268
+ def parse(_arg0); end
269
+
270
+ private
271
+
272
+ def new(*_arg0); end
273
+ def saj; end
274
+ def usual; end
275
+ def validate; end
276
+
277
+ class << self
278
+ def new(*_arg0); end
279
+ def saj; end
280
+ def usual; end
281
+ def validate; end
282
+ end
283
+ end
284
+
285
+ module Oj::Rails
286
+ private
287
+
288
+ def deoptimize(*_arg0); end
289
+ def encode(*_arg0); end
290
+ def mimic_JSON; end
291
+ def optimize(*_arg0); end
292
+ def optimized?(_arg0); end
293
+ def set_decoder; end
294
+ def set_encoder; end
295
+
296
+ class << self
297
+ def deoptimize(*_arg0); end
298
+ def encode(*_arg0); end
299
+ def mimic_JSON; end
300
+ def optimize(*_arg0); end
301
+ def optimized?(_arg0); end
302
+ def set_decoder; end
303
+ def set_encoder; end
304
+ end
305
+ end
306
+
307
+ class Oj::Rails::Encoder
308
+ def deoptimize(*_arg0); end
309
+ def encode(_arg0); end
310
+ def optimize(*_arg0); end
311
+ def optimized?(_arg0); end
312
+
313
+ private
314
+
315
+ def new(*_arg0); end
316
+
317
+ class << self
318
+ def new(*_arg0); end
319
+ end
320
+ end
321
+
322
+ # A SAX style parse handler for JSON hence the acronym SAJ for Simple API
323
+ # for JSON. The Oj::Saj handler class can be subclassed and then used with
324
+ # the Oj::Saj key_parse() method or with the more resent
325
+ # Oj::Parser.new(:saj). The Saj methods will then be called as the file is
326
+ # parsed.
327
+ #
328
+ # With Oj::Parser.new(:saj) each method can also include a line and column
329
+ # argument so hash_start(key) could also be hash_start(key, line,
330
+ # column). The error() method is no used with Oj::Parser.new(:saj) so it
331
+ # will never be called.
332
+ #
333
+ # or
334
+ #
335
+ # p = Oj::Parser.new(:saj)
336
+ # p.handler = MySaj.new()
337
+ # File.open('any.json', 'r') do |f|
338
+ # p.parse(f.read)
339
+ # end
340
+ #
341
+ # To make the desired methods active while parsing the desired method should
342
+ # be made public in the subclasses. If the methods remain private they will
343
+ # not be called during parsing.
344
+ #
345
+ # def hash_start(key); end
346
+ # def hash_end(key); end
347
+ # def array_start(key); end
348
+ # def array_end(key); end
349
+ # def add_value(value, key); end
350
+ # def error(message, line, column); end
351
+ #
352
+ # @example
353
+ #
354
+ # require 'oj'
355
+ #
356
+ # class MySaj < ::Oj::Saj
357
+ # def initialize()
358
+ # @hash_cnt = 0
359
+ # end
360
+ #
361
+ # def hash_start(key)
362
+ # @hash_cnt += 1
363
+ # end
364
+ # end
365
+ #
366
+ # cnt = MySaj.new()
367
+ # File.open('any.json', 'r') do |f|
368
+ # Oj.saj_parse(cnt, f)
369
+ # end
370
+ #
371
+ # source://oj//lib/oj/saj.rb#51
372
+ class Oj::Saj
373
+ # Create a new instance of the Saj handler class.
374
+ #
375
+ # @return [Saj] a new instance of Saj
376
+ #
377
+ # source://oj//lib/oj/saj.rb#53
378
+ def initialize; end
379
+
380
+ private
381
+
382
+ # source://oj//lib/oj/saj.rb#73
383
+ def add_value(value, key); end
384
+
385
+ # source://oj//lib/oj/saj.rb#70
386
+ def array_end(key); end
387
+
388
+ # source://oj//lib/oj/saj.rb#67
389
+ def array_start(key); end
390
+
391
+ # source://oj//lib/oj/saj.rb#76
392
+ def error(message, line, column); end
393
+
394
+ # source://oj//lib/oj/saj.rb#64
395
+ def hash_end(key); end
396
+
397
+ # source://oj//lib/oj/saj.rb#61
398
+ def hash_start(key); end
399
+ end
400
+
401
+ # A Simple Callback Parser (SCP) for JSON. The Oj::ScHandler class should be
402
+ # subclassed and then used with the Oj.sc_parse() method. The Scp methods will
403
+ # then be called as the file is parsed. The handler does not have to be a
404
+ # subclass of the ScHandler class as long as it responds to the desired
405
+ # methods.
406
+ #
407
+ # To make the desired methods active while parsing the desired method should
408
+ # be made public in the subclasses. If the methods remain private they will
409
+ # not be called during parsing.
410
+ #
411
+ # def hash_start(); end
412
+ # def hash_end(); end
413
+ # def hash_key(key); end
414
+ # def hash_set(h, key, value); end
415
+ # def array_start(); end
416
+ # def array_end(); end
417
+ # def array_append(a, value); end
418
+ # def add_value(value); end
419
+ #
420
+ # As certain elements of a JSON document are reached during parsing the
421
+ # callbacks are called. The parser helps by keeping track of objects created
422
+ # by the callbacks but does not create those objects itself.
423
+ #
424
+ # hash_start
425
+ #
426
+ # When a JSON object element starts the hash_start() callback is called if
427
+ # public. It should return what ever Ruby Object is to be used as the element
428
+ # that will later be included in the hash_set() callback.
429
+ #
430
+ # hash_end
431
+ #
432
+ # When a hash key is encountered the hash_key method is called with the parsed
433
+ # hash value key. The return value from the call is then used as the key in
434
+ # the key-value pair that follows.
435
+ #
436
+ # hash_key
437
+ #
438
+ # At the end of a JSON object element the hash_end() callback is called if public.
439
+ #
440
+ # hash_set
441
+ #
442
+ # When a key value pair is encountered during parsing the hash_set() callback
443
+ # is called if public. The first element will be the object returned from the
444
+ # enclosing hash_start() callback. The second argument is the key and the last
445
+ # is the value.
446
+ #
447
+ # array_start
448
+ #
449
+ # When a JSON array element is started the array_start() callback is called if
450
+ # public. It should return what ever Ruby Object is to be used as the element
451
+ # that will later be included in the array_append() callback.
452
+ #
453
+ # array_end
454
+ #
455
+ # At the end of a JSON array element the array_end() callback is called if public.
456
+ #
457
+ # array_append
458
+ #
459
+ # When a element is encountered that is an element of an array the
460
+ # array_append() callback is called if public. The first argument to the
461
+ # callback is the Ruby object returned from the enclosing array_start()
462
+ # callback.
463
+ #
464
+ # add_value
465
+ #
466
+ # The handler is expected to handle multiple JSON elements in one stream,
467
+ # file, or string. When a top level JSON has been read completely the
468
+ # add_value() callback is called. Even if only one element was ready this
469
+ # callback returns the Ruby object that was constructed during the parsing.
470
+ #
471
+ # @example
472
+ #
473
+ # require 'oj'
474
+ #
475
+ # class MyHandler < ::Oj::ScHandler
476
+ # def hash_start
477
+ # {}
478
+ # end
479
+ #
480
+ # def hash_set(h,k,v)
481
+ # h[k] = v
482
+ # end
483
+ #
484
+ # def array_start
485
+ # []
486
+ # end
487
+ #
488
+ # def array_append(a,v)
489
+ # a << v
490
+ # end
491
+ #
492
+ # def add_value(v)
493
+ # p v
494
+ # end
495
+ #
496
+ # def error(message, line, column)
497
+ # p "ERROR: #{message}"
498
+ # end
499
+ # end
500
+ #
501
+ # File.open('any.json', 'r') do |f|
502
+ # Oj.sc_parse(MyHandler.new, f)
503
+ # end
504
+ #
505
+ # source://oj//lib/oj/schandler.rb#106
506
+ class Oj::ScHandler
507
+ # Create a new instance of the ScHandler class.
508
+ #
509
+ # @return [ScHandler] a new instance of ScHandler
510
+ #
511
+ # source://oj//lib/oj/schandler.rb#108
512
+ def initialize; end
513
+
514
+ private
515
+
516
+ # source://oj//lib/oj/schandler.rb#135
517
+ def add_value(value); end
518
+
519
+ # source://oj//lib/oj/schandler.rb#138
520
+ def array_append(a, value); end
521
+
522
+ # source://oj//lib/oj/schandler.rb#132
523
+ def array_end; end
524
+
525
+ # source://oj//lib/oj/schandler.rb#129
526
+ def array_start; end
527
+
528
+ # source://oj//lib/oj/schandler.rb#119
529
+ def hash_end; end
530
+
531
+ # source://oj//lib/oj/schandler.rb#122
532
+ def hash_key(key); end
533
+
534
+ # source://oj//lib/oj/schandler.rb#126
535
+ def hash_set(h, key, value); end
536
+
537
+ # source://oj//lib/oj/schandler.rb#116
538
+ def hash_start; end
539
+ end
540
+
541
+ class Oj::StreamWriter
542
+ def flush; end
543
+ def pop; end
544
+ def pop_all; end
545
+ def push_array(*_arg0); end
546
+ def push_json(*_arg0); end
547
+ def push_key(_arg0); end
548
+ def push_object(*_arg0); end
549
+ def push_value(*_arg0); end
550
+
551
+ private
552
+
553
+ def new(*_arg0); end
554
+
555
+ class << self
556
+ def new(*_arg0); end
557
+ end
558
+ end
559
+
560
+ class Oj::StringWriter
561
+ def as_json; end
562
+ def pop; end
563
+ def pop_all; end
564
+ def push_array(*_arg0); end
565
+ def push_json(*_arg0); end
566
+ def push_key(_arg0); end
567
+ def push_object(*_arg0); end
568
+ def push_value(*_arg0); end
569
+ def raw_json; end
570
+ def reset; end
571
+ def to_s; end
572
+
573
+ private
574
+
575
+ def new(*_arg0); end
576
+
577
+ class << self
578
+ def new(*_arg0); end
579
+ end
580
+ end
581
+
582
+ # Current version of the module.
583
+ #
584
+ # source://oj//lib/oj/version.rb#4
585
+ Oj::VERSION = T.let(T.unsafe(nil), String)
586
+
587
+ # More monkey patches.
588
+ #
589
+ # source://oj//lib/oj/mimic.rb#282
590
+ class String
591
+ include ::Comparable
592
+
593
+ # source://oj//lib/oj/mimic.rb#289
594
+ def to_json_raw(*_arg0); end
595
+
596
+ # source://oj//lib/oj/mimic.rb#283
597
+ def to_json_raw_object; end
598
+
599
+ class << self
600
+ # source://oj//lib/oj/mimic.rb#292
601
+ def json_create(obj); end
602
+ end
603
+ end