optimistic-json 0.1.1 → 0.1.3

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +10 -0
  5. data/README.md +4 -0
  6. data/Rakefile +5 -1
  7. data/lib/optimistic/json/parser.rb +28 -7
  8. data/lib/optimistic/json/version.rb +2 -1
  9. data/lib/optimistic/json.rb +1 -1
  10. data/sorbet/config +4 -0
  11. data/sorbet/rbi/annotations/.gitattributes +1 -0
  12. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  13. data/sorbet/rbi/gems/.gitattributes +1 -0
  14. data/sorbet/rbi/gems/ast@2.4.2.rbi +550 -0
  15. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  16. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1068 -0
  17. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  18. data/sorbet/rbi/gems/gem-release@2.2.2.rbi +1335 -0
  19. data/sorbet/rbi/gems/io-console@0.6.0.rbi +9 -0
  20. data/sorbet/rbi/gems/json@2.7.0.rbi +1797 -0
  21. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +12986 -0
  22. data/sorbet/rbi/gems/logger@1.6.0.rbi +845 -0
  23. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +218 -0
  24. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  25. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  26. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +5154 -0
  27. data/sorbet/rbi/gems/prism@1.9.0.rbi +42224 -0
  28. data/sorbet/rbi/gems/psych@5.1.1.1.rbi +2321 -0
  29. data/sorbet/rbi/gems/racc@1.7.3.rbi +169 -0
  30. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  31. data/sorbet/rbi/gems/rake@13.1.0.rbi +3025 -0
  32. data/sorbet/rbi/gems/rbi@0.3.11.rbi +5505 -0
  33. data/sorbet/rbi/gems/rbs@4.0.2.rbi +6908 -0
  34. data/sorbet/rbi/gems/rdoc@6.6.0.rbi +9 -0
  35. data/sorbet/rbi/gems/regexp_parser@2.8.2.rbi +3268 -0
  36. data/sorbet/rbi/gems/reline@0.4.1.rbi +9 -0
  37. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  38. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4798 -0
  39. data/sorbet/rbi/gems/rspec-core@3.12.2.rbi +9405 -0
  40. data/sorbet/rbi/gems/rspec-expectations@3.12.3.rbi +6013 -0
  41. data/sorbet/rbi/gems/rspec-mocks@3.12.6.rbi +4750 -0
  42. data/sorbet/rbi/gems/rspec-support@3.12.1.rbi +1261 -0
  43. data/sorbet/rbi/gems/rspec@3.12.0.rbi +15 -0
  44. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +6750 -0
  45. data/sorbet/rbi/gems/rubocop-capybara@2.19.0.rbi +1058 -0
  46. data/sorbet/rbi/gems/rubocop-factory_bot@2.24.0.rbi +875 -0
  47. data/sorbet/rbi/gems/rubocop-rspec@2.25.0.rbi +7696 -0
  48. data/sorbet/rbi/gems/rubocop@1.58.0.rbi +53790 -0
  49. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  50. data/sorbet/rbi/gems/rubydex@0.2.3.rbi +787 -0
  51. data/sorbet/rbi/gems/spoom@1.7.14.rbi +6151 -0
  52. data/sorbet/rbi/gems/stringio@3.1.0.rbi +9 -0
  53. data/sorbet/rbi/gems/tapioca@0.19.1.rbi +3558 -0
  54. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  55. data/sorbet/rbi/gems/tsort@0.2.0.rbi +387 -0
  56. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +64 -0
  57. data/sorbet/tapioca/config.yml +13 -0
  58. data/sorbet/tapioca/require.rb +4 -0
  59. metadata +55 -23
  60. data/sig/optimistic/json.rbs +0 -6
@@ -0,0 +1,621 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `benchmark` gem.
5
+ # Please instead update this file by running `bin/tapioca gem benchmark`.
6
+
7
+
8
+ # The Benchmark module provides methods to measure and report the time
9
+ # used to execute Ruby code.
10
+ #
11
+ # * Measure the time to construct the string given by the expression
12
+ # <code>"a"*1_000_000_000</code>:
13
+ #
14
+ # require 'benchmark'
15
+ #
16
+ # puts Benchmark.measure { "a"*1_000_000_000 }
17
+ #
18
+ # On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates:
19
+ #
20
+ # 0.350000 0.400000 0.750000 ( 0.835234)
21
+ #
22
+ # This report shows the user CPU time, system CPU time, the total time
23
+ # (sum of user CPU time, system CPU time, children's user CPU time,
24
+ # and children's system CPU time), and the elapsed real time. The unit
25
+ # of time is seconds.
26
+ #
27
+ # * Do some experiments sequentially using the #bm method:
28
+ #
29
+ # require 'benchmark'
30
+ #
31
+ # n = 5000000
32
+ # Benchmark.bm do |x|
33
+ # x.report { for i in 1..n; a = "1"; end }
34
+ # x.report { n.times do ; a = "1"; end }
35
+ # x.report { 1.upto(n) do ; a = "1"; end }
36
+ # end
37
+ #
38
+ # The result:
39
+ #
40
+ # user system total real
41
+ # 1.010000 0.000000 1.010000 ( 1.014479)
42
+ # 1.000000 0.000000 1.000000 ( 0.998261)
43
+ # 0.980000 0.000000 0.980000 ( 0.981335)
44
+ #
45
+ # * Continuing the previous example, put a label in each report:
46
+ #
47
+ # require 'benchmark'
48
+ #
49
+ # n = 5000000
50
+ # Benchmark.bm(7) do |x|
51
+ # x.report("for:") { for i in 1..n; a = "1"; end }
52
+ # x.report("times:") { n.times do ; a = "1"; end }
53
+ # x.report("upto:") { 1.upto(n) do ; a = "1"; end }
54
+ # end
55
+ #
56
+ # The result:
57
+ #
58
+ # user system total real
59
+ # for: 1.010000 0.000000 1.010000 ( 1.015688)
60
+ # times: 1.000000 0.000000 1.000000 ( 1.003611)
61
+ # upto: 1.030000 0.000000 1.030000 ( 1.028098)
62
+ #
63
+ # * The times for some benchmarks depend on the order in which items
64
+ # are run. These differences are due to the cost of memory
65
+ # allocation and garbage collection. To avoid these discrepancies,
66
+ # the #bmbm method is provided. For example, to compare ways to
67
+ # sort an array of floats:
68
+ #
69
+ # require 'benchmark'
70
+ #
71
+ # array = (1..1000000).map { rand }
72
+ #
73
+ # Benchmark.bmbm do |x|
74
+ # x.report("sort!") { array.dup.sort! }
75
+ # x.report("sort") { array.dup.sort }
76
+ # end
77
+ #
78
+ # The result:
79
+ #
80
+ # Rehearsal -----------------------------------------
81
+ # sort! 1.490000 0.010000 1.500000 ( 1.490520)
82
+ # sort 1.460000 0.000000 1.460000 ( 1.463025)
83
+ # -------------------------------- total: 2.960000sec
84
+ #
85
+ # user system total real
86
+ # sort! 1.460000 0.000000 1.460000 ( 1.460465)
87
+ # sort 1.450000 0.010000 1.460000 ( 1.448327)
88
+ #
89
+ # * Report statistics of sequential experiments with unique labels,
90
+ # using the #benchmark method:
91
+ #
92
+ # require 'benchmark'
93
+ # include Benchmark # we need the CAPTION and FORMAT constants
94
+ #
95
+ # n = 5000000
96
+ # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
97
+ # tf = x.report("for:") { for i in 1..n; a = "1"; end }
98
+ # tt = x.report("times:") { n.times do ; a = "1"; end }
99
+ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
100
+ # [tf+tt+tu, (tf+tt+tu)/3]
101
+ # end
102
+ #
103
+ # The result:
104
+ #
105
+ # user system total real
106
+ # for: 0.950000 0.000000 0.950000 ( 0.952039)
107
+ # times: 0.980000 0.000000 0.980000 ( 0.984938)
108
+ # upto: 0.950000 0.000000 0.950000 ( 0.946787)
109
+ # >total: 2.880000 0.000000 2.880000 ( 2.883764)
110
+ # >avg: 0.960000 0.000000 0.960000 ( 0.961255)
111
+ #
112
+ # pkg:gem/benchmark#lib/benchmark.rb:123
113
+ module Benchmark
114
+ private
115
+
116
+ # Invokes the block with a Benchmark::Report object, which
117
+ # may be used to collect and report on the results of individual
118
+ # benchmark tests. Reserves +label_width+ leading spaces for
119
+ # labels on each line. Prints +caption+ at the top of the
120
+ # report, and uses +format+ to format each line.
121
+ # (Note: +caption+ must contain a terminating newline character,
122
+ # see the default Benchmark::Tms::CAPTION for an example.)
123
+ #
124
+ # Returns an array of Benchmark::Tms objects.
125
+ #
126
+ # If the block returns an array of
127
+ # Benchmark::Tms objects, these will be used to format
128
+ # additional lines of output. If +labels+ parameter are
129
+ # given, these are used to label these extra lines.
130
+ #
131
+ # _Note_: Other methods provide a simpler interface to this one, and are
132
+ # suitable for nearly all benchmarking requirements. See the examples in
133
+ # Benchmark, and the #bm and #bmbm methods.
134
+ #
135
+ # Example:
136
+ #
137
+ # require 'benchmark'
138
+ # include Benchmark # we need the CAPTION and FORMAT constants
139
+ #
140
+ # n = 5000000
141
+ # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
142
+ # tf = x.report("for:") { for i in 1..n; a = "1"; end }
143
+ # tt = x.report("times:") { n.times do ; a = "1"; end }
144
+ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
145
+ # [tf+tt+tu, (tf+tt+tu)/3]
146
+ # end
147
+ #
148
+ # Generates:
149
+ #
150
+ # user system total real
151
+ # for: 0.970000 0.000000 0.970000 ( 0.970493)
152
+ # times: 0.990000 0.000000 0.990000 ( 0.989542)
153
+ # upto: 0.970000 0.000000 0.970000 ( 0.972854)
154
+ # >total: 2.930000 0.000000 2.930000 ( 2.932889)
155
+ # >avg: 0.976667 0.000000 0.976667 ( 0.977630)
156
+ #
157
+ # pkg:gem/benchmark#lib/benchmark.rb:171
158
+ def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
159
+
160
+ # A simple interface to the #benchmark method, #bm generates sequential
161
+ # reports with labels. +label_width+ and +labels+ parameters have the same
162
+ # meaning as for #benchmark.
163
+ #
164
+ # require 'benchmark'
165
+ #
166
+ # n = 5000000
167
+ # Benchmark.bm(7) do |x|
168
+ # x.report("for:") { for i in 1..n; a = "1"; end }
169
+ # x.report("times:") { n.times do ; a = "1"; end }
170
+ # x.report("upto:") { 1.upto(n) do ; a = "1"; end }
171
+ # end
172
+ #
173
+ # Generates:
174
+ #
175
+ # user system total real
176
+ # for: 0.960000 0.000000 0.960000 ( 0.957966)
177
+ # times: 0.960000 0.000000 0.960000 ( 0.960423)
178
+ # upto: 0.950000 0.000000 0.950000 ( 0.954864)
179
+ #
180
+ # pkg:gem/benchmark#lib/benchmark.rb:216
181
+ def bm(label_width = T.unsafe(nil), *labels, &blk); end
182
+
183
+ # Sometimes benchmark results are skewed because code executed
184
+ # earlier encounters different garbage collection overheads than
185
+ # that run later. #bmbm attempts to minimize this effect by running
186
+ # the tests twice, the first time as a rehearsal in order to get the
187
+ # runtime environment stable, the second time for
188
+ # real. GC.start is executed before the start of each of
189
+ # the real timings; the cost of this is not included in the
190
+ # timings. In reality, though, there's only so much that #bmbm can
191
+ # do, and the results are not guaranteed to be isolated from garbage
192
+ # collection and other effects.
193
+ #
194
+ # Because #bmbm takes two passes through the tests, it can
195
+ # calculate the required label width.
196
+ #
197
+ # require 'benchmark'
198
+ #
199
+ # array = (1..1000000).map { rand }
200
+ #
201
+ # Benchmark.bmbm do |x|
202
+ # x.report("sort!") { array.dup.sort! }
203
+ # x.report("sort") { array.dup.sort }
204
+ # end
205
+ #
206
+ # Generates:
207
+ #
208
+ # Rehearsal -----------------------------------------
209
+ # sort! 1.440000 0.010000 1.450000 ( 1.446833)
210
+ # sort 1.440000 0.000000 1.440000 ( 1.448257)
211
+ # -------------------------------- total: 2.890000sec
212
+ #
213
+ # user system total real
214
+ # sort! 1.460000 0.000000 1.460000 ( 1.458065)
215
+ # sort 1.450000 0.000000 1.450000 ( 1.455963)
216
+ #
217
+ # #bmbm yields a Benchmark::Job object and returns an array of
218
+ # Benchmark::Tms objects.
219
+ #
220
+ # pkg:gem/benchmark#lib/benchmark.rb:258
221
+ def bmbm(width = T.unsafe(nil)); end
222
+
223
+ # Returns the time used to execute the given block as a
224
+ # Benchmark::Tms object. Takes +label+ option.
225
+ #
226
+ # require 'benchmark'
227
+ #
228
+ # n = 1000000
229
+ #
230
+ # time = Benchmark.measure do
231
+ # n.times { a = "1" }
232
+ # end
233
+ # puts time
234
+ #
235
+ # Generates:
236
+ #
237
+ # 0.220000 0.000000 0.220000 ( 0.227313)
238
+ #
239
+ # pkg:gem/benchmark#lib/benchmark.rb:303
240
+ def measure(label = T.unsafe(nil)); end
241
+
242
+ # Returns the elapsed real time used to execute the given block.
243
+ # The unit of time is milliseconds.
244
+ #
245
+ # Benchmark.ms { "a" * 1_000_000_000 }
246
+ # #=> 509.8029999935534
247
+ #
248
+ # pkg:gem/benchmark#lib/benchmark.rb:335
249
+ def ms; end
250
+
251
+ # Returns the elapsed real time used to execute the given block.
252
+ # The unit of time is seconds.
253
+ #
254
+ # Benchmark.realtime { "a" * 1_000_000_000 }
255
+ # #=> 0.5098029999935534
256
+ #
257
+ # pkg:gem/benchmark#lib/benchmark.rb:322
258
+ def realtime; end
259
+
260
+ class << self
261
+ # Invokes the block with a Benchmark::Report object, which
262
+ # may be used to collect and report on the results of individual
263
+ # benchmark tests. Reserves +label_width+ leading spaces for
264
+ # labels on each line. Prints +caption+ at the top of the
265
+ # report, and uses +format+ to format each line.
266
+ # (Note: +caption+ must contain a terminating newline character,
267
+ # see the default Benchmark::Tms::CAPTION for an example.)
268
+ #
269
+ # Returns an array of Benchmark::Tms objects.
270
+ #
271
+ # If the block returns an array of
272
+ # Benchmark::Tms objects, these will be used to format
273
+ # additional lines of output. If +labels+ parameter are
274
+ # given, these are used to label these extra lines.
275
+ #
276
+ # _Note_: Other methods provide a simpler interface to this one, and are
277
+ # suitable for nearly all benchmarking requirements. See the examples in
278
+ # Benchmark, and the #bm and #bmbm methods.
279
+ #
280
+ # Example:
281
+ #
282
+ # require 'benchmark'
283
+ # include Benchmark # we need the CAPTION and FORMAT constants
284
+ #
285
+ # n = 5000000
286
+ # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
287
+ # tf = x.report("for:") { for i in 1..n; a = "1"; end }
288
+ # tt = x.report("times:") { n.times do ; a = "1"; end }
289
+ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
290
+ # [tf+tt+tu, (tf+tt+tu)/3]
291
+ # end
292
+ #
293
+ # Generates:
294
+ #
295
+ # user system total real
296
+ # for: 0.970000 0.000000 0.970000 ( 0.970493)
297
+ # times: 0.990000 0.000000 0.990000 ( 0.989542)
298
+ # upto: 0.970000 0.000000 0.970000 ( 0.972854)
299
+ # >total: 2.930000 0.000000 2.930000 ( 2.932889)
300
+ # >avg: 0.976667 0.000000 0.976667 ( 0.977630)
301
+ #
302
+ # pkg:gem/benchmark#lib/benchmark.rb:341
303
+ def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
304
+
305
+ # A simple interface to the #benchmark method, #bm generates sequential
306
+ # reports with labels. +label_width+ and +labels+ parameters have the same
307
+ # meaning as for #benchmark.
308
+ #
309
+ # require 'benchmark'
310
+ #
311
+ # n = 5000000
312
+ # Benchmark.bm(7) do |x|
313
+ # x.report("for:") { for i in 1..n; a = "1"; end }
314
+ # x.report("times:") { n.times do ; a = "1"; end }
315
+ # x.report("upto:") { 1.upto(n) do ; a = "1"; end }
316
+ # end
317
+ #
318
+ # Generates:
319
+ #
320
+ # user system total real
321
+ # for: 0.960000 0.000000 0.960000 ( 0.957966)
322
+ # times: 0.960000 0.000000 0.960000 ( 0.960423)
323
+ # upto: 0.950000 0.000000 0.950000 ( 0.954864)
324
+ #
325
+ # pkg:gem/benchmark#lib/benchmark.rb:341
326
+ def bm(label_width = T.unsafe(nil), *labels, &blk); end
327
+
328
+ # Sometimes benchmark results are skewed because code executed
329
+ # earlier encounters different garbage collection overheads than
330
+ # that run later. #bmbm attempts to minimize this effect by running
331
+ # the tests twice, the first time as a rehearsal in order to get the
332
+ # runtime environment stable, the second time for
333
+ # real. GC.start is executed before the start of each of
334
+ # the real timings; the cost of this is not included in the
335
+ # timings. In reality, though, there's only so much that #bmbm can
336
+ # do, and the results are not guaranteed to be isolated from garbage
337
+ # collection and other effects.
338
+ #
339
+ # Because #bmbm takes two passes through the tests, it can
340
+ # calculate the required label width.
341
+ #
342
+ # require 'benchmark'
343
+ #
344
+ # array = (1..1000000).map { rand }
345
+ #
346
+ # Benchmark.bmbm do |x|
347
+ # x.report("sort!") { array.dup.sort! }
348
+ # x.report("sort") { array.dup.sort }
349
+ # end
350
+ #
351
+ # Generates:
352
+ #
353
+ # Rehearsal -----------------------------------------
354
+ # sort! 1.440000 0.010000 1.450000 ( 1.446833)
355
+ # sort 1.440000 0.000000 1.440000 ( 1.448257)
356
+ # -------------------------------- total: 2.890000sec
357
+ #
358
+ # user system total real
359
+ # sort! 1.460000 0.000000 1.460000 ( 1.458065)
360
+ # sort 1.450000 0.000000 1.450000 ( 1.455963)
361
+ #
362
+ # #bmbm yields a Benchmark::Job object and returns an array of
363
+ # Benchmark::Tms objects.
364
+ #
365
+ # pkg:gem/benchmark#lib/benchmark.rb:341
366
+ def bmbm(width = T.unsafe(nil)); end
367
+
368
+ # Returns the time used to execute the given block as a
369
+ # Benchmark::Tms object. Takes +label+ option.
370
+ #
371
+ # require 'benchmark'
372
+ #
373
+ # n = 1000000
374
+ #
375
+ # time = Benchmark.measure do
376
+ # n.times { a = "1" }
377
+ # end
378
+ # puts time
379
+ #
380
+ # Generates:
381
+ #
382
+ # 0.220000 0.000000 0.220000 ( 0.227313)
383
+ #
384
+ # pkg:gem/benchmark#lib/benchmark.rb:341
385
+ def measure(label = T.unsafe(nil)); end
386
+
387
+ # Returns the elapsed real time used to execute the given block.
388
+ # The unit of time is milliseconds.
389
+ #
390
+ # Benchmark.ms { "a" * 1_000_000_000 }
391
+ # #=> 509.8029999935534
392
+ #
393
+ # pkg:gem/benchmark#lib/benchmark.rb:341
394
+ def ms; end
395
+
396
+ # Returns the elapsed real time used to execute the given block.
397
+ # The unit of time is seconds.
398
+ #
399
+ # Benchmark.realtime { "a" * 1_000_000_000 }
400
+ # #=> 0.5098029999935534
401
+ #
402
+ # pkg:gem/benchmark#lib/benchmark.rb:341
403
+ def realtime; end
404
+ end
405
+ end
406
+
407
+ # A Job is a sequence of labelled blocks to be processed by the
408
+ # Benchmark.bmbm method. It is of little direct interest to the user.
409
+ #
410
+ # pkg:gem/benchmark#lib/benchmark.rb:347
411
+ class Benchmark::Job
412
+ # Returns an initialized Job instance.
413
+ # Usually, one doesn't call this method directly, as new
414
+ # Job objects are created by the #bmbm method.
415
+ # +width+ is a initial value for the label offset used in formatting;
416
+ # the #bmbm method passes its +width+ argument to this constructor.
417
+ #
418
+ # pkg:gem/benchmark#lib/benchmark.rb:355
419
+ def initialize(width); end
420
+
421
+ # Registers the given label and block pair in the job list.
422
+ #
423
+ # pkg:gem/benchmark#lib/benchmark.rb:363
424
+ def item(label = T.unsafe(nil), &blk); end
425
+
426
+ # An array of 2-element arrays, consisting of label and block pairs.
427
+ #
428
+ # pkg:gem/benchmark#lib/benchmark.rb:375
429
+ def list; end
430
+
431
+ # pkg:gem/benchmark#lib/benchmark.rb:372
432
+ def report(label = T.unsafe(nil), &blk); end
433
+
434
+ # Length of the widest label in the #list.
435
+ #
436
+ # pkg:gem/benchmark#lib/benchmark.rb:378
437
+ def width; end
438
+ end
439
+
440
+ # This class is used by the Benchmark.benchmark and Benchmark.bm methods.
441
+ # It is of little direct interest to the user.
442
+ #
443
+ # pkg:gem/benchmark#lib/benchmark.rb:385
444
+ class Benchmark::Report
445
+ # Returns an initialized Report instance.
446
+ # Usually, one doesn't call this method directly, as new
447
+ # Report objects are created by the #benchmark and #bm methods.
448
+ # +width+ and +format+ are the label offset and
449
+ # format string used by Tms#format.
450
+ #
451
+ # pkg:gem/benchmark#lib/benchmark.rb:393
452
+ def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end
453
+
454
+ # An array of Benchmark::Tms objects representing each item.
455
+ #
456
+ # pkg:gem/benchmark#lib/benchmark.rb:412
457
+ def format; end
458
+
459
+ # Prints the +label+ and measured time for the block,
460
+ # formatted by +format+. See Tms#format for the
461
+ # formatting rules.
462
+ #
463
+ # pkg:gem/benchmark#lib/benchmark.rb:402
464
+ def item(label = T.unsafe(nil), *format, &blk); end
465
+
466
+ # An array of Benchmark::Tms objects representing each item.
467
+ #
468
+ # pkg:gem/benchmark#lib/benchmark.rb:412
469
+ def list; end
470
+
471
+ # pkg:gem/benchmark#lib/benchmark.rb:409
472
+ def report(label = T.unsafe(nil), *format, &blk); end
473
+
474
+ # An array of Benchmark::Tms objects representing each item.
475
+ #
476
+ # pkg:gem/benchmark#lib/benchmark.rb:412
477
+ def width; end
478
+ end
479
+
480
+ # A data object, representing the times associated with a benchmark
481
+ # measurement.
482
+ #
483
+ # pkg:gem/benchmark#lib/benchmark.rb:421
484
+ class Benchmark::Tms
485
+ # Returns an initialized Tms object which has
486
+ # +utime+ as the user CPU time, +stime+ as the system CPU time,
487
+ # +cutime+ as the children's user CPU time, +cstime+ as the children's
488
+ # system CPU time, +real+ as the elapsed real time and +label+ as the label.
489
+ #
490
+ # pkg:gem/benchmark#lib/benchmark.rb:456
491
+ def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end
492
+
493
+ # Returns a new Tms object obtained by memberwise multiplication
494
+ # of the individual times for this Tms object by +x+.
495
+ #
496
+ # pkg:gem/benchmark#lib/benchmark.rb:504
497
+ def *(x); end
498
+
499
+ # Returns a new Tms object obtained by memberwise summation
500
+ # of the individual times for this Tms object with those of the +other+
501
+ # Tms object.
502
+ # This method and #/() are useful for taking statistics.
503
+ #
504
+ # pkg:gem/benchmark#lib/benchmark.rb:491
505
+ def +(other); end
506
+
507
+ # Returns a new Tms object obtained by memberwise subtraction
508
+ # of the individual times for the +other+ Tms object from those of this
509
+ # Tms object.
510
+ #
511
+ # pkg:gem/benchmark#lib/benchmark.rb:498
512
+ def -(other); end
513
+
514
+ # Returns a new Tms object obtained by memberwise division
515
+ # of the individual times for this Tms object by +x+.
516
+ # This method and #+() are useful for taking statistics.
517
+ #
518
+ # pkg:gem/benchmark#lib/benchmark.rb:511
519
+ def /(x); end
520
+
521
+ # Returns a new Tms object whose times are the sum of the times for this
522
+ # Tms object, plus the time required to execute the code block (+blk+).
523
+ #
524
+ # pkg:gem/benchmark#lib/benchmark.rb:465
525
+ def add(&blk); end
526
+
527
+ # An in-place version of #add.
528
+ # Changes the times of this Tms object by making it the sum of the times
529
+ # for this Tms object, plus the time required to execute
530
+ # the code block (+blk+).
531
+ #
532
+ # pkg:gem/benchmark#lib/benchmark.rb:475
533
+ def add!(&blk); end
534
+
535
+ # System CPU time of children
536
+ #
537
+ # pkg:gem/benchmark#lib/benchmark.rb:439
538
+ def cstime; end
539
+
540
+ # User CPU time of children
541
+ #
542
+ # pkg:gem/benchmark#lib/benchmark.rb:436
543
+ def cutime; end
544
+
545
+ # Returns the contents of this Tms object as
546
+ # a formatted string, according to a +format+ string
547
+ # like that passed to Kernel.format. In addition, #format
548
+ # accepts the following extensions:
549
+ #
550
+ # <tt>%u</tt>:: Replaced by the user CPU time, as reported by Tms#utime.
551
+ # <tt>%y</tt>:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem")
552
+ # <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime
553
+ # <tt>%Y</tt>:: Replaced by the children's system CPU time, as reported by Tms#cstime
554
+ # <tt>%t</tt>:: Replaced by the total CPU time, as reported by Tms#total
555
+ # <tt>%r</tt>:: Replaced by the elapsed real time, as reported by Tms#real
556
+ # <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
557
+ #
558
+ # If +format+ is not given, FORMAT is used as default value, detailing the
559
+ # user, system, total and real elapsed time.
560
+ #
561
+ # pkg:gem/benchmark#lib/benchmark.rb:530
562
+ def format(format = T.unsafe(nil), *args); end
563
+
564
+ # Label
565
+ #
566
+ # pkg:gem/benchmark#lib/benchmark.rb:448
567
+ def label; end
568
+
569
+ # Elapsed real time
570
+ #
571
+ # pkg:gem/benchmark#lib/benchmark.rb:442
572
+ def real; end
573
+
574
+ # System CPU time
575
+ #
576
+ # pkg:gem/benchmark#lib/benchmark.rb:433
577
+ def stime; end
578
+
579
+ # Returns a new 6-element array, consisting of the
580
+ # label, user CPU time, system CPU time, children's
581
+ # user CPU time, children's system CPU time and elapsed
582
+ # real time.
583
+ #
584
+ # pkg:gem/benchmark#lib/benchmark.rb:555
585
+ def to_a; end
586
+
587
+ # Returns a hash containing the same data as `to_a`.
588
+ #
589
+ # pkg:gem/benchmark#lib/benchmark.rb:562
590
+ def to_h; end
591
+
592
+ # Same as #format.
593
+ #
594
+ # pkg:gem/benchmark#lib/benchmark.rb:545
595
+ def to_s; end
596
+
597
+ # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+
598
+ #
599
+ # pkg:gem/benchmark#lib/benchmark.rb:445
600
+ def total; end
601
+
602
+ # User CPU time
603
+ #
604
+ # pkg:gem/benchmark#lib/benchmark.rb:430
605
+ def utime; end
606
+
607
+ protected
608
+
609
+ # Returns a new Tms object obtained by memberwise operation +op+
610
+ # of the individual times for this Tms object with those of the other
611
+ # Tms object (+x+).
612
+ #
613
+ # +op+ can be a mathematical operation such as <tt>+</tt>, <tt>-</tt>,
614
+ # <tt>*</tt>, <tt>/</tt>
615
+ #
616
+ # pkg:gem/benchmark#lib/benchmark.rb:583
617
+ def memberwise(op, x); end
618
+ end
619
+
620
+ # pkg:gem/benchmark#lib/benchmark.rb:125
621
+ Benchmark::VERSION = T.let(T.unsafe(nil), String)