schema_dot_org 1.7.1 → 1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,1431 +0,0 @@
1
- # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
- # srb rbi sorbet-typed
3
- #
4
- # If you would like to make changes to this file, great! Please upstream any changes you make here:
5
- #
6
- # https://github.com/sorbet/sorbet-typed/edit/master/lib/activesupport/all/activesupport.rbi
7
- #
8
- # typed: ignore
9
-
10
- module ActiveSupport
11
- sig { params(kind: Symbol, blk: T.proc.bind(T.untyped).void).void }
12
- def self.on_load(kind, &blk); end
13
- end
14
-
15
- class Object
16
- sig { params(duck: T.any(String, Symbol)).returns(T::Boolean) }
17
- def acts_like?(duck); end
18
-
19
- sig {returns(T::Boolean)}
20
- def blank?; end
21
-
22
- sig { returns(T.self_type) }
23
- def deep_dup; end
24
-
25
- sig { returns(TrueClass) }
26
- def duplicable?; end
27
-
28
- sig { params(another_object: Object).returns(T::Boolean) }
29
- def in?(another_object); end
30
-
31
- sig { returns(T::Hash[String, T.untyped]) }
32
- def instance_values; end
33
-
34
- sig { returns(T::Array[String]) }
35
- def instance_variable_names; end
36
-
37
- sig { returns(T.nilable(T.self_type)) }
38
- def presence; end
39
-
40
- sig { returns(T::Boolean) }
41
- def present?; end
42
-
43
- sig { returns(String) }
44
- def to_param; end
45
-
46
- sig { params(key: String).returns(String) }
47
- def to_query(key); end
48
-
49
- sig do
50
- params(
51
- method_name: T.any(Symbol, String, NilClass),
52
- args: T.untyped,
53
- b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
54
- ).returns(T.untyped)
55
- end
56
- def try(method_name = nil, *args, &b); end
57
-
58
- sig do
59
- params(
60
- method_name: T.any(Symbol, String, NilClass),
61
- args: T.untyped,
62
- b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
63
- ).returns(T.untyped)
64
- end
65
- def try!(method_name = nil, *args, &b); end
66
-
67
- sig do
68
- params(
69
- options: T::Hash[T.untyped, T.untyped],
70
- block: T.nilable(T.proc.returns(T.untyped))
71
- ).returns(T.untyped)
72
- end
73
- def with_options(options, &block); end
74
- end
75
-
76
- class FalseClass
77
- sig { returns(NilClass) }
78
- def presence; end
79
- end
80
-
81
- class Method
82
- sig { returns(FalseClass) }
83
- def duplicable?; end
84
- end
85
-
86
- class NilClass
87
- sig { returns(T::Boolean) }
88
- def duplicable?; end
89
-
90
- sig do
91
- params(
92
- method_name: T.any(Symbol, String, NilClass),
93
- args: T.untyped,
94
- b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
95
- ).returns(NilClass)
96
- end
97
- def try(method_name = nil, *args, &b); end
98
-
99
- sig do
100
- params(
101
- method_name: T.any(Symbol, String, NilClass),
102
- args: T.untyped,
103
- b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
104
- ).returns(NilClass)
105
- end
106
- def try!(method_name = nil, *args, &b); end
107
- end
108
-
109
- class String
110
- sig { returns(T::Boolean) }
111
- def acts_like_string?; end
112
-
113
- sig { params(position: T.any(Integer, String, Regexp, T::Range[Integer])).returns(T.nilable(String)) }
114
- def at(position); end
115
-
116
- sig { returns(T::Boolean) }
117
- def blank?; end
118
-
119
- sig { params(first_letter: Symbol).returns(String) }
120
- def camelize(first_letter = :upper); end
121
-
122
- # camelcase is an alias of camelize
123
- sig { params(first_letter: Symbol).returns(String) }
124
- def camelcase(first_letter = :upper); end
125
-
126
- sig { returns(String) }
127
- def classify; end
128
-
129
- sig { returns(Module) }
130
- def constantize; end
131
-
132
- sig { returns(String) }
133
- def dasherize; end
134
-
135
- sig { returns(String) }
136
- def deconstantize; end
137
-
138
- sig { returns(String) }
139
- def demodulize; end
140
-
141
- # ends_with? is an alias of the core method 'end_with?'
142
- sig { params(arg0: String).returns(T::Boolean) }
143
- def ends_with?(*arg0); end
144
-
145
- sig { params(string: String).returns(T::Boolean) }
146
- def exclude?(string); end
147
-
148
- sig { params(limit: Integer).returns(String) }
149
- def first(limit = 1); end
150
-
151
- sig { params(separate_class_name_and_id_with_underscore: T::Boolean).returns(String) }
152
- def foreign_key(separate_class_name_and_id_with_underscore = true); end
153
-
154
- sig { params(position: Integer).returns(String) }
155
- def from(position); end
156
-
157
- sig { returns(T.untyped) }
158
- def html_safe; end
159
-
160
- sig { params(capitalize: T::Boolean, keep_id_suffix: T::Boolean).returns(String) }
161
- def humanize(capitalize: true, keep_id_suffix: false); end
162
-
163
- # returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
164
- sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
165
- def in_time_zone(zone = ::Time.zone); end
166
-
167
- sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
168
- def indent!(amount, indent_string = nil, indent_empty_lines = false); end
169
-
170
- sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
171
- def indent(amount, indent_string = nil, indent_empty_lines = false); end
172
-
173
- sig { returns(ActiveSupport::StringInquirer) }
174
- def inquiry; end
175
-
176
- sig { returns(T::Boolean) }
177
- def is_utf8?; end
178
-
179
- sig { params(limit: Integer).returns(String) }
180
- def last(limit = 1); end
181
-
182
- sig { returns(ActiveSupport::Multibyte::Chars) }
183
- def mb_chars; end
184
-
185
- sig { params(separator: String, preserve_case: T::Boolean).returns(String) }
186
- def parameterize(separator: "-", preserve_case: false); end
187
-
188
- sig { params(count: T.nilable(Integer), locale: Symbol).returns(String) }
189
- def pluralize(count = nil, locale = :en); end
190
-
191
- sig { params(patterns: T.untyped).returns(T.untyped) }
192
- def remove!(*patterns); end
193
-
194
- sig { params(patterns: T.untyped).returns(T.untyped) }
195
- def remove(*patterns); end
196
-
197
- sig { returns(T.untyped) }
198
- def safe_constantize; end
199
-
200
- sig { params(locale: Symbol).returns(String) }
201
- def singularize(locale = :en); end
202
-
203
- sig { returns(String) }
204
- def squish!; end
205
-
206
- sig { returns(String) }
207
- def squish; end
208
-
209
- # starts_with? is an alias of the core method 'start_with?''
210
- sig { params(arg0: String).returns(T::Boolean) }
211
- def starts_with?(*arg0); end
212
-
213
- sig { returns(String) }
214
- def strip_heredoc; end
215
-
216
- sig { returns(String) }
217
- def tableize; end
218
-
219
- sig { params(keep_id_suffix: T::Boolean).returns(String) }
220
- def titleize(keep_id_suffix: false); end
221
-
222
- # titlecase is an alias of titleize
223
- sig { params(keep_id_suffix: T::Boolean).returns(String) }
224
- def titlecase(keep_id_suffix: false); end
225
-
226
- sig { params(position: Integer).returns(String) }
227
- def to(position); end
228
-
229
- sig { returns(T.nilable(Date)) }
230
- def to_date; end
231
-
232
- sig { returns(T.nilable(DateTime)) }
233
- def to_datetime; end
234
-
235
- sig { params(form: Symbol).returns(T.nilable(Time)) }
236
- def to_time(form = :local); end
237
-
238
- sig { params(truncate_at: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
239
- def truncate(truncate_at, separator: nil, omission: "..."); end
240
-
241
- sig { params(words_count: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
242
- def truncate_words(words_count, separator: nil, omission: "..."); end
243
-
244
- sig { returns(String) }
245
- def underscore; end
246
-
247
- sig { returns(String) }
248
- def upcase_first; end
249
- end
250
-
251
- class Array
252
- sig { returns(T::Boolean) }
253
- def blank?; end
254
-
255
- sig { returns(T::Array[T.untyped]) }
256
- def deep_dup; end
257
-
258
- sig { returns(T::Hash[T.untyped, T.untyped]) }
259
- def extract_options!; end
260
-
261
- sig { returns(T.nilable(Elem)) }
262
- def fifth; end
263
-
264
- sig { returns(T.nilable(Elem)) }
265
- def forty_two; end
266
-
267
- sig { returns(T.nilable(Elem)) }
268
- def fourth; end
269
-
270
- sig { params(position: Integer).returns(T::Array[T.untyped]) }
271
- def from(position); end
272
-
273
- sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
274
- def in_groups(number, fill_with = nil); end
275
-
276
- sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
277
- def in_groups_of(number, fill_with = nil); end
278
-
279
- sig { returns(T.untyped) }
280
- def inquiry; end
281
-
282
- sig { returns(T.nilable(Elem)) }
283
- def second; end
284
-
285
- sig { returns(T.nilable(Elem)) }
286
- def second_to_last; end
287
-
288
- sig do
289
- params(
290
- value: T.untyped,
291
- blk: T.proc.params(arg0: Elem).void
292
- ).returns(T::Array[Elem])
293
- end
294
- def split(value = nil, &blk); end
295
-
296
- sig { returns(T.nilable(Elem)) }
297
- def third; end
298
-
299
- sig { returns(T.nilable(Elem)) }
300
- def third_to_last; end
301
-
302
- sig { params(position: Integer).returns(T::Array[T.untyped]) }
303
- def to(position); end
304
-
305
- # to_default_s is an alias of the core method 'to_s'
306
- sig {returns(String)}
307
- def to_default_s; end
308
-
309
- sig { params(format: Symbol).returns(String) }
310
- def to_formatted_s(format = :default); end
311
-
312
- sig { returns(String) }
313
- def to_param; end
314
-
315
- sig { params(key: String).returns(String) }
316
- def to_query(key); end
317
-
318
- sig do
319
- params(
320
- words_connector: String,
321
- two_words_connector: String,
322
- last_word_connector: String,
323
- locale: T.nilable(Symbol)
324
- ).returns(String)
325
- end
326
- def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: ", and ", locale: nil); end
327
-
328
- sig { params(options: T.untyped).returns(T.untyped) }
329
- def to_xml(options = nil); end
330
-
331
- sig { params(elements: T.untyped).returns(T.untyped) }
332
- def without(*elements); end
333
- end
334
-
335
- module ActiveSupport::NumberHelper
336
- sig do
337
- params(
338
- number: T.any(Integer, Float, String),
339
- locale: Symbol,
340
- precision: T.nilable(Integer),
341
- unit: String,
342
- separator: String,
343
- delimiter: String,
344
- format: String,
345
- negative_format: String
346
- ).returns(String)
347
- end
348
- def number_to_currency(number, locale: :en, precision: 2, unit: "$", separator: ".", delimiter: ",", format: "%u%n", negative_format: "-%u%n"); end
349
-
350
- sig do
351
- params(
352
- number: T.any(Integer, Float, String),
353
- locale: Symbol,
354
- delimiter: String,
355
- separator: String,
356
- delimiter_pattern: T.nilable(Regexp)
357
- ).returns(String)
358
- end
359
- def number_to_delimited(number, locale: :en, delimiter: ",", separator: ".", delimiter_pattern: nil); end
360
-
361
- sig do
362
- params(
363
- number: T.any(Integer, Float, String),
364
- locale: Symbol,
365
- precision: T.nilable(Integer),
366
- significant: T::Boolean,
367
- separator: String,
368
- delimiter: String,
369
- strip_insignificant_zeros: T::Boolean,
370
- units: T.any(T::Hash[T.untyped, T.untyped], String, Symbol),
371
- format: String
372
- ).returns(String)
373
- end
374
- def number_to_human(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true, units: {}, format: "%n %u"); end
375
-
376
- sig do
377
- params(
378
- number: T.any(Integer, Float, String),
379
- locale: Symbol,
380
- precision: T.nilable(Integer),
381
- significant: T::Boolean,
382
- separator: String,
383
- delimiter: String,
384
- strip_insignificant_zeros: T::Boolean
385
- ).returns(String)
386
- end
387
- def number_to_human_size(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true); end
388
-
389
- sig do
390
- params(
391
- number: T.any(Integer, Float, String),
392
- locale: Symbol,
393
- precision: T.nilable(Integer),
394
- significant: T::Boolean,
395
- separator: String,
396
- delimiter: String,
397
- strip_insignificant_zeros: T::Boolean,
398
- format: String
399
- ).returns(String)
400
- end
401
- def number_to_percentage(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false, format: "%n%"); end
402
-
403
- sig do
404
- params(
405
- number: T.any(Integer, Float, String),
406
- area_code: T::Boolean,
407
- delimiter: String,
408
- extension: T.nilable(Integer),
409
- country_code: T.nilable(Integer),
410
- pattern: T.nilable(Regexp)
411
- ).returns(String)
412
- end
413
- def number_to_phone(number, area_code: false, delimiter: "-", extension: nil, country_code: nil, pattern: nil); end
414
-
415
- sig do
416
- params(
417
- number: T.any(Integer, Float, String),
418
- locale: Symbol,
419
- precision: T.nilable(Integer),
420
- significant: T::Boolean,
421
- separator: String,
422
- delimiter: String,
423
- strip_insignificant_zeros: T::Boolean
424
- ).returns(String)
425
- end
426
- def number_to_rounded(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false); end
427
- end
428
-
429
- module ActiveSupport::Inflector
430
- sig do
431
- params(
432
- term: String,
433
- uppercase_first_letter: T::Boolean
434
- ).returns(String)
435
- end
436
- def camelize(term, uppercase_first_letter = true); end
437
-
438
- sig { params(table_name: String).returns(String) }
439
- def classify(table_name); end
440
-
441
- sig { params(camel_cased_word: String).returns(T.untyped) }
442
- def constantize(camel_cased_word); end
443
-
444
- sig { params(underscored_word: String).returns(String) }
445
- def dasherize(underscored_word); end
446
-
447
- sig { params(path: String).returns(String) }
448
- def deconstantize(path); end
449
-
450
- sig { params(path: String).returns(String) }
451
- def demodulize(path); end
452
-
453
- sig do
454
- params(
455
- class_name: String,
456
- separate_class_name_and_id_with_underscore: T::Boolean
457
- ).returns(String)
458
- end
459
- def foreign_key(class_name, separate_class_name_and_id_with_underscore = true); end
460
-
461
- sig do
462
- params(
463
- lower_case_and_underscored_word: String,
464
- capitalize: T::Boolean,
465
- keep_id_suffix: T::Boolean
466
- ).returns(String)
467
- end
468
- def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false); end
469
-
470
- sig { params(locale: Symbol, blk: T.untyped).returns(T.untyped) }
471
- def inflections(locale = :en, &blk); end
472
-
473
- sig { params(number: Integer).returns(String) }
474
- def ordinal(number); end
475
-
476
- sig { params(number: Integer).returns(String) }
477
- def ordinalize(number); end
478
-
479
- sig do
480
- params(
481
- string: String,
482
- separator: String,
483
- preserve_case: T::Boolean,
484
- locale: Symbol
485
- ).returns(String)
486
- end
487
- def parameterize(string, separator: '-', preserve_case: false, locale: nil); end
488
-
489
- sig { params(word: String, locale: Symbol).returns(String) }
490
- def pluralize(word, locale = :en); end
491
-
492
- sig { params(camel_cased_word: String).returns(T.untyped) }
493
- def safe_constantize(camel_cased_word); end
494
-
495
- sig { params(word: String, locale: Symbol).returns(String) }
496
- def singularize(word, locale = :en); end
497
-
498
- sig { params(class_name: String).returns(String) }
499
- def tableize(class_name); end
500
-
501
- sig { params(word: String, keep_id_suffix: T::Boolean).returns(String) }
502
- def titleize(word, keep_id_suffix: false); end
503
-
504
- sig { params(string: String, replacement: String, locale: Symbol).returns(String) }
505
- def transliterate(string, replacement = '?', locale: nil); end
506
-
507
- sig { params(camel_cased_word: String).returns(String) }
508
- def underscore(camel_cased_word); end
509
-
510
- sig { params(string: String).returns(String) }
511
- def upcase_first(string); end
512
- end
513
-
514
- # defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time/calculations.rb
515
- # these get added to Time, but are available on TimeWithZone thanks to https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/time_with_zone.rb#L520
516
- # this is not a complete definition!
517
- class ActiveSupport::TimeWithZone
518
- sig { returns(ActiveSupport::TimeWithZone) }
519
- def midnight; end
520
-
521
- sig { returns(ActiveSupport::TimeWithZone) }
522
- def beginning_of_day; end
523
-
524
- sig { returns(ActiveSupport::TimeWithZone) }
525
- def at_midnight; end
526
-
527
- sig { returns(ActiveSupport::TimeWithZone) }
528
- def at_beginning_of_day; end
529
-
530
- sig { returns(ActiveSupport::TimeWithZone) }
531
- def middle_of_day; end
532
-
533
- sig { returns(ActiveSupport::TimeWithZone) }
534
- def midday; end
535
-
536
- sig { returns(ActiveSupport::TimeWithZone) }
537
- def noon; end
538
-
539
- sig { returns(ActiveSupport::TimeWithZone) }
540
- def at_midday; end
541
-
542
- sig { returns(ActiveSupport::TimeWithZone) }
543
- def at_noon; end
544
-
545
- sig { returns(ActiveSupport::TimeWithZone) }
546
- def at_middle_of_day; end
547
-
548
- sig { returns(ActiveSupport::TimeWithZone) }
549
- def end_of_day; end
550
-
551
- sig { returns(ActiveSupport::TimeWithZone) }
552
- def at_end_of_day; end
553
-
554
- sig { returns(ActiveSupport::TimeWithZone) }
555
- def end_of_year; end
556
-
557
- sig { returns(ActiveSupport::TimeWithZone) }
558
- def at_end_of_year; end
559
-
560
- sig { returns(ActiveSupport::TimeWithZone) }
561
- def beginning_of_year; end
562
-
563
- sig { returns(ActiveSupport::TimeWithZone) }
564
- def at_beginning_of_year; end
565
-
566
- sig { returns(ActiveSupport::TimeWithZone) }
567
- def end_of_month; end
568
-
569
- sig { returns(ActiveSupport::TimeWithZone) }
570
- def at_end_of_month; end
571
-
572
- sig { returns(ActiveSupport::TimeWithZone) }
573
- def beginning_of_month; end
574
-
575
- sig { returns(ActiveSupport::TimeWithZone) }
576
- def at_beginning_of_month; end
577
-
578
- sig { returns(ActiveSupport::TimeWithZone) }
579
- def end_of_hour; end
580
-
581
- sig { returns(ActiveSupport::TimeWithZone) }
582
- def at_end_of_hour; end
583
-
584
- sig { returns(ActiveSupport::TimeWithZone) }
585
- def beginning_of_hour; end
586
-
587
- sig { returns(ActiveSupport::TimeWithZone) }
588
- def at_beginning_of_hour; end
589
-
590
- # Returns a `Time` instance that represents the time in `time_zone`.
591
- sig { returns(Time) }
592
- def time; end
593
-
594
- # Returns a `Time` instance of the simultaneous time in the UTC timezone.
595
- sig { returns(Time) }
596
- def utc; end
597
-
598
- # Returns the underlying TZInfo::TimezonePeriod.
599
- sig { returns(TZInfo::TimezonePeriod) }
600
- def period; end
601
-
602
- # Returns the simultaneous time in `Time.zone`, or the specified zone.
603
- sig { params(new_zone: T.untyped).returns(ActiveSupport::TimeWithZone) }
604
- def in_time_zone(new_zone = ::Time.zone); end
605
-
606
- # Returns a `Time` instance of the simultaneous time in the system timezone.
607
- sig { params(utc_offset: T.untyped).returns(Time) }
608
- def localtime(utc_offset = nil); end
609
-
610
- ### The following methods are generated dynamically and call to the corresponding Time methods.
611
-
612
- sig { returns(Integer) }
613
- def year; end
614
-
615
- sig { returns(Integer) }
616
- def mon; end
617
-
618
- sig { returns(Integer) }
619
- def month; end
620
-
621
- sig { returns(Integer) }
622
- def day; end
623
-
624
- sig { returns(Integer) }
625
- def mday; end
626
-
627
- sig { returns(Integer) }
628
- def wday; end
629
-
630
- sig { returns(Integer) }
631
- def yday; end
632
-
633
- sig { returns(Integer) }
634
- def hour; end
635
-
636
- sig { returns(Integer) }
637
- def min; end
638
-
639
- sig { returns(Integer) }
640
- def sec; end
641
-
642
- sig { returns(Numeric) }
643
- def usec; end
644
-
645
- sig { returns(Numeric) }
646
- def nsec; end
647
-
648
- ### End dynamically-generated methods
649
-
650
- # Returns true if the current time is within Daylight Savings Time for the
651
- # specified time zone.
652
- #
653
- # ```ruby
654
- # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
655
- # Time.zone.parse("2012-5-30").dst? # => true
656
- # Time.zone.parse("2012-11-30").dst? # => false
657
- # ```
658
- sig { returns(T::Boolean) }
659
- def dst?; end
660
-
661
- # Returns true if the current time zone is set to UTC.
662
- #
663
- # ```ruby
664
- # Time.zone = 'UTC' # => 'UTC'
665
- # Time.zone.now.utc? # => true
666
- # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
667
- # Time.zone.now.utc? # => false
668
- # ```
669
- sig { returns(T::Boolean) }
670
- def utc?; end
671
-
672
- # Returns the offset from current time to UTC time in seconds.
673
- sig { returns(Integer) }
674
- def utc_offset; end
675
-
676
- # Returns a formatted string of the offset from UTC, or an alternative
677
- # string if the time zone is already UTC.
678
- #
679
- # ```ruby
680
- # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
681
- # Time.zone.now.formatted_offset(true) # => "-05:00"
682
- # Time.zone.now.formatted_offset(false) # => "-0500"
683
- # Time.zone = 'UTC' # => "UTC"
684
- # Time.zone.now.formatted_offset(true, "0") # => "0"
685
- # ```
686
- sig { params(colon: T::Boolean, alternate_utc_string: T.untyped).returns(String) }
687
- def formatted_offset(colon = true, alternate_utc_string = nil); end
688
-
689
- # Returns the time zone abbreviation.
690
- #
691
- # ```ruby
692
- # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
693
- # Time.zone.now.zone # => "EST"
694
- # ```
695
- sig { returns(String) }
696
- def zone; end
697
-
698
- # Returns a string of the object's date, time, zone, and offset from UTC.
699
- #
700
- # ```ruby
701
- # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25 EST -05:00"
702
- # ```
703
- sig { returns(String) }
704
- def inspect; end
705
-
706
- # Returns a string of the object's date and time in the ISO 8601 standard
707
- # format.
708
- #
709
- # ```ruby
710
- # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
711
- # ```
712
- sig { params(fraction_digits: Integer).returns(String) }
713
- def xmlschema(fraction_digits = 0); end
714
-
715
- # Returns a string of the object's date and time in the format used by
716
- # HTTP requests.
717
- #
718
- # ```ruby
719
- # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT"
720
- # ```
721
- sig { returns(String) }
722
- def httpdate; end
723
-
724
- # Returns a string of the object's date and time in the RFC 2822 standard
725
- # format.
726
- #
727
- # ```ruby
728
- # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
729
- # ```
730
- sig { returns(String) }
731
- def rfc2822; end
732
-
733
- # Returns a string of the object's date and time.
734
- # Accepts an optional `format`:
735
- # * `:default` - default value, mimics Ruby Time#to_s format.
736
- # * `:db` - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
737
- # * Any key in `Time::DATE_FORMATS` can be used. See active_support/core_ext/time/conversions.rb.
738
- sig { params(format: Symbol).returns(String) }
739
- def to_s(format = :default); end
740
-
741
- # Replaces `%Z` directive with +zone before passing to Time#strftime,
742
- # so that zone information is correct.
743
- sig { params(format: String).returns(String) }
744
- def strftime(format); end
745
-
746
- # Returns true if the current object's time is within the specified
747
- # `min` and `max` time.
748
- sig { params(min: T.untyped, max: T.untyped).returns(T::Boolean) }
749
- def between?(min, max); end
750
-
751
- # Returns true if the current object's time is in the past.
752
- sig { returns(T::Boolean) }
753
- def past?; end
754
-
755
- # Returns true if the current object's time falls within
756
- # the current day.
757
- sig { returns(T::Boolean) }
758
- def today?; end
759
-
760
- # Returns true if the current object's time is in the future.
761
- sig { returns(T::Boolean) }
762
- def future?; end
763
-
764
- # Returns `true` if `other` is equal to current object.
765
- sig { params(other: T.untyped).returns(T::Boolean) }
766
- def eql?(other); end
767
-
768
- # Adds an interval of time to the current object's time and returns that
769
- # value as a new TimeWithZone object.
770
- #
771
- # ```ruby
772
- # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
773
- # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
774
- # now + 1000 # => Sun, 02 Nov 2014 01:43:08 EDT -04:00
775
- # ```
776
- #
777
- # If we're adding a Duration of variable length (i.e., years, months, days),
778
- # move forward from #time, otherwise move forward from #utc, for accuracy
779
- # when moving across DST boundaries.
780
- #
781
- # For instance, a time + 24.hours will advance exactly 24 hours, while a
782
- # time + 1.day will advance 23-25 hours, depending on the day.
783
- #
784
- # ```ruby
785
- # now + 24.hours # => Mon, 03 Nov 2014 00:26:28 EST -05:00
786
- # now + 1.day # => Mon, 03 Nov 2014 01:26:28 EST -05:00
787
- # ```
788
- sig { params(other: T.untyped).returns(ActiveSupport::TimeWithZone) }
789
- def +(other); end
790
-
791
- # Subtracts an interval of time and returns a new TimeWithZone object unless
792
- # the other value `acts_like?` time. Then it will return a Float of the difference
793
- # between the two times that represents the difference between the current
794
- # object's time and the `other` time.
795
- #
796
- # ```ruby
797
- # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
798
- # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00
799
- # now - 1000 # => Mon, 03 Nov 2014 00:09:48 EST -05:00
800
- # ```
801
- #
802
- # If subtracting a Duration of variable length (i.e., years, months, days),
803
- # move backward from #time, otherwise move backward from #utc, for accuracy
804
- # when moving across DST boundaries.
805
- #
806
- # For instance, a time - 24.hours will go subtract exactly 24 hours, while a
807
- # time - 1.day will subtract 23-25 hours, depending on the day.
808
- #
809
- # ```ruby
810
- # now - 24.hours # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
811
- # now - 1.day # => Sun, 02 Nov 2014 00:26:28 EDT -04:00
812
- # ```
813
- #
814
- # If both the TimeWithZone object and the other value act like Time, a Float
815
- # will be returned.
816
- #
817
- # ```ruby
818
- # Time.zone.now - 1.day.ago # => 86399.999967
819
- # ```
820
- sig { params(other: T.untyped).returns(T.any(ActiveSupport::TimeWithZone, Float)) }
821
- def -(other); end
822
-
823
- # Subtracts an interval of time from the current object's time and returns
824
- # the result as a new TimeWithZone object.
825
- #
826
- # ```ruby
827
- # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
828
- # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00
829
- # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48 EST -05:00
830
- # ```
831
- #
832
- # If we're subtracting a Duration of variable length (i.e., years, months,
833
- # days), move backward from #time, otherwise move backward from #utc, for
834
- # accuracy when moving across DST boundaries.
835
- #
836
- # For instance, `time.ago(24.hours)` will move back exactly 24 hours,
837
- # while `time.ago(1.day)` will move back 23-25 hours, depending on
838
- # the day.
839
- #
840
- # ```ruby
841
- # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
842
- # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28 EDT -04:00
843
- # ```
844
- sig { params(other: T.any(Numeric, ActiveSupport::Duration)).returns(ActiveSupport::TimeWithZone) }
845
- def ago(other); end
846
-
847
- # Returns Array of parts of Time in sequence of
848
- # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone].
849
- #
850
- # ```ruby
851
- # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27 UTC +00:00
852
- # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"]
853
- # ```
854
- sig { returns([Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, T::Boolean, String]) }
855
- def to_a; end
856
-
857
- # Returns the object's date and time as a floating point number of seconds
858
- # since the Epoch (January 1, 1970 00:00 UTC).
859
- #
860
- # ```ruby
861
- # Time.zone.now.to_f # => 1417709320.285418
862
- # ```
863
- sig { returns(Float) }
864
- def to_f; end
865
-
866
- # Returns the object's date and time as an integer number of seconds
867
- # since the Epoch (January 1, 1970 00:00 UTC).
868
- #
869
- # ```ruby
870
- # Time.zone.now.to_i # => 1417709320
871
- # ```
872
- sig { returns(Integer) }
873
- def to_i; end
874
-
875
- # Returns the object's date and time as a rational number of seconds
876
- # since the Epoch (January 1, 1970 00:00 UTC).
877
- #
878
- # ```ruby
879
- # Time.zone.now.to_r # => (708854548642709/500000)
880
- # ```
881
- sig { returns(Rational) }
882
- def to_r; end
883
-
884
- sig { returns(Date) }
885
- def to_date; end
886
-
887
- # Returns an instance of DateTime with the timezone's UTC offset
888
- #
889
- # ```ruby
890
- # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000
891
- # Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000
892
- # ```
893
- sig { returns(DateTime) }
894
- def to_datetime; end
895
-
896
- # Returns an instance of `Time`, either with the same UTC offset
897
- # as `self` or in the local system timezone depending on the setting
898
- # of `ActiveSupport.to_time_preserves_timezone`.
899
- sig { returns(Time) }
900
- def to_time; end
901
-
902
- # Uses Date to provide precise Time calculations for years, months, and days according to the proleptic Gregorian calendar.
903
- # The result is returned as a new `TimeWithZone` object.
904
- # The options parameter takes a hash with any of these keys: :years, :months, :weeks, :days, :hours, :minutes, :seconds.
905
- # If advancing by a value of variable length (i.e., years, weeks, months, days), move forward from `time`, otherwise move forward
906
- # from utc, for accuracy when moving across DST boundaries.
907
- sig { params(options: T::Hash[Symbol, T.any(Integer, Float)]).returns(ActiveSupport::TimeWithZone) }
908
- def advance(options); end
909
- end
910
-
911
- # defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date
912
- # this is not a complete definition!
913
- class Date
914
- sig { params(options: T::Hash[Symbol, Integer]).returns(Date) }
915
- def advance(options); end
916
-
917
- # these are the sigs for Date- in the stdlib
918
- # https://github.com/sorbet/sorbet/blob/3910f6cfd9935c9b42e2135e32e15ab8a6e5b9be/rbi/stdlib/date.rbi#L373
919
- # note that if more sigs are added to sorbet you should replicate them here
920
- # check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/date.rbi
921
- sig {params(arg0: Numeric).returns(T.self_type)}
922
- sig {params(arg0: Date).returns(Rational)}
923
- # these sigs are added for activesupport users
924
- sig {params(arg0: ActiveSupport::Duration).returns(T.self_type)}
925
- def -(arg0); end
926
- end
927
-
928
- # defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time
929
- # this is not a complete definition!
930
- class Time
931
- sig { returns(Time) }
932
- def midnight; end
933
-
934
- sig { returns(Time) }
935
- def beginning_of_day; end
936
-
937
- sig { params(options: T::Hash[Symbol, Integer]).returns(Time) }
938
- def advance(options); end
939
-
940
- sig { returns(Time) }
941
- def at_midnight; end
942
-
943
- sig { returns(Time) }
944
- def at_beginning_of_day; end
945
-
946
- sig { returns(Time) }
947
- def middle_of_day; end
948
-
949
- sig { returns(Time) }
950
- def midday; end
951
-
952
- sig { returns(Time) }
953
- def noon; end
954
-
955
- sig { returns(Time) }
956
- def at_midday; end
957
-
958
- sig { returns(Time) }
959
- def at_noon; end
960
-
961
- sig { returns(Time) }
962
- def at_middle_of_day; end
963
-
964
- # https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
965
- # returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
966
- sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
967
- def in_time_zone(zone = ::Time.zone); end
968
-
969
- # these are the sigs for Time- in the stdlib
970
- # https://github.com/sorbet/sorbet/blob/c3691753e4ce545e1eb66cbd3e55de67d8879b98/rbi/core/time.rbi#L347
971
- # note that if more sigs are added to sorbet you should replicate them here
972
- # check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/core/time.rbi#L347
973
- sig do
974
- params(
975
- arg0: Time,
976
- )
977
- .returns(Float)
978
- end
979
- sig do
980
- params(
981
- arg0: Numeric,
982
- )
983
- .returns(Time)
984
- end
985
- # these sigs are added for activesupport users
986
- sig { params(arg0: ActiveSupport::Duration).returns(Time) }
987
- def -(arg0); end
988
-
989
- # Returns the TimeZone for the current request, if this has been set (via Time.zone=).
990
- # If `Time.zone` has not been set for the current request, returns the TimeZone specified in `config.time_zone`.
991
- sig { returns(ActiveSupport::TimeZone) }
992
- def self.zone; end
993
-
994
- # Sets `Time.zone` to a TimeZone object for the current request/thread.
995
- #
996
- # This method accepts any of the following:
997
- #
998
- # * A Rails TimeZone object.
999
- # * An identifier for a Rails TimeZone object (e.g., "Eastern Time (US & Canada)", `-5.hours`).
1000
- # * A TZInfo::Timezone object.
1001
- # * An identifier for a TZInfo::Timezone object (e.g., "America/New_York").
1002
- #
1003
- # Here's an example of how you might set `Time.zone` on a per request basis and reset it when the request is done.
1004
- # `current_user.time_zone` just needs to return a string identifying the user's preferred time zone:
1005
- #
1006
- # ```ruby
1007
- # class ApplicationController < ActionController::Base
1008
- # around_action :set_time_zone
1009
- #
1010
- # def set_time_zone
1011
- # if logged_in?
1012
- # Time.use_zone(current_user.time_zone) { yield }
1013
- # else
1014
- # yield
1015
- # end
1016
- # end
1017
- # end
1018
- # ```
1019
- sig { params(time_zone: T.any(String, TZInfo::Timezone, ActiveSupport::TimeZone, ActiveSupport::Duration)).void }
1020
- def self.zone=(time_zone); end
1021
- end
1022
-
1023
- class ActiveSupport::TimeZone
1024
- # Locate a specific time zone object. If the argument is a string, it
1025
- # is interpreted to mean the name of the timezone to locate. If it is a
1026
- # numeric value it is either the hour offset, or the second offset, of the
1027
- # timezone to find. (The first one with that offset will be returned.)
1028
- # Returns `nil` if no such time zone is known to the system.
1029
- sig { params(arg: T.any(String, Numeric, ActiveSupport::Duration)).returns(T.nilable(ActiveSupport::TimeZone)) }
1030
- def self.[](arg); end
1031
-
1032
- # Returns an array of all TimeZone objects. There are multiple
1033
- # TimeZone objects per time zone, in many cases, to make it easier
1034
- # for users to find their own time zone.
1035
- sig { returns(T::Array[ActiveSupport::TimeZone]) }
1036
- def self.all; end
1037
-
1038
- # A convenience method for returning a collection of TimeZone objects
1039
- # for time zones in the USA.
1040
- sig { returns(T::Array[ActiveSupport::TimeZone]) }
1041
- def self.us_zones; end
1042
-
1043
- # A convenience method for returning a collection of TimeZone objects
1044
- # for time zones in the country specified by its ISO 3166-1 Alpha2 code.
1045
- sig { params(country_code: T.any(String, Symbol)).returns(T::Array[ActiveSupport::TimeZone]) }
1046
- def self.country_zones(country_code); end
1047
-
1048
- # Returns an ActiveSupport::TimeWithZone instance representing the current
1049
- # time in the time zone represented by `self`.
1050
- #
1051
- # ```ruby
1052
- # Time.zone = 'Hawaii' # => "Hawaii"
1053
- # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
1054
- # ```
1055
- sig { returns(ActiveSupport::TimeWithZone) }
1056
- def now; end
1057
-
1058
- # Returns the current date in this time zone.
1059
- sig { returns(Date) }
1060
- def today; end
1061
-
1062
- # Returns the next date in this time zone.
1063
- sig { returns(Date) }
1064
- def tomorrow; end
1065
-
1066
- # Returns the previous date in this time zone.
1067
- sig { returns(Date) }
1068
- def yesterday; end
1069
-
1070
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
1071
- # of `self` from given values.
1072
- #
1073
- # ```ruby
1074
- # Time.zone = 'Hawaii' # => "Hawaii"
1075
- # Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00
1076
- # ```
1077
- sig { params(args: T.untyped).returns(ActiveSupport::TimeWithZone) }
1078
- def local(*args); end
1079
- end
1080
-
1081
- # defines some of the methods at https://github.com/rails/rails/tree/v6.0.0/activesupport/lib/active_support/core_ext/hash
1082
- # this is not a complete definition!
1083
- class Hash
1084
- sig { returns(T::Hash[String, T.untyped]) }
1085
- def stringify_keys; end
1086
-
1087
- sig { returns(T::Hash[String, T.untyped]) }
1088
- def stringify_keys!; end
1089
-
1090
- sig { returns(T::Hash[String, T.untyped]) }
1091
- def deep_stringify_keys; end
1092
-
1093
- sig { returns(T::Hash[String, T.untyped]) }
1094
- def deep_stringify_keys!; end
1095
-
1096
- sig { returns(T::Hash[Symbol, T.untyped]) }
1097
- def symbolize_keys; end
1098
-
1099
- sig { returns(T::Hash[Symbol, T.untyped]) }
1100
- def symbolize_keys!; end
1101
-
1102
- sig { returns(T::Hash[Symbol, T.untyped]) }
1103
- def deep_symbolize_keys; end
1104
-
1105
- sig { returns(T::Hash[Symbol, T.untyped]) }
1106
- def deep_symbolize_keys!; end
1107
-
1108
- # in an ideal world, `arg` would be the type of all keys, the 1st `T.untyped` would be
1109
- # the type of keys your block returns, and the 2nd `T.untyped` would be the type of values
1110
- # that the hash had.
1111
- sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
1112
- def deep_transform_keys(&block); end
1113
-
1114
- sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
1115
- def deep_transform_keys!(&block); end
1116
-
1117
- sig { returns(T::Hash[Symbol, T.untyped]) }
1118
- def to_options; end
1119
- end
1120
-
1121
- class Integer
1122
- # Returns a Duration instance matching the number of months provided.
1123
- #
1124
- # ```ruby
1125
- # 2.months # => 2 months
1126
- # ```
1127
- sig { returns(ActiveSupport::Duration) }
1128
- def months; end
1129
-
1130
- sig { returns(ActiveSupport::Duration) }
1131
- def month; end
1132
-
1133
- # Returns a Duration instance matching the number of years provided.
1134
- #
1135
- # ```ruby
1136
- # 2.years # => 2 years
1137
- # ```
1138
- sig { returns(ActiveSupport::Duration) }
1139
- def years; end
1140
-
1141
- sig { returns(ActiveSupport::Duration) }
1142
- def year; end
1143
- end
1144
-
1145
- class Numeric
1146
- sig { returns(ActiveSupport::Duration) }
1147
- def second; end
1148
-
1149
- sig { returns(ActiveSupport::Duration) }
1150
- def seconds; end
1151
-
1152
- sig { returns(ActiveSupport::Duration) }
1153
- def minute; end
1154
-
1155
- sig { returns(ActiveSupport::Duration) }
1156
- def minutes; end
1157
-
1158
- sig { returns(ActiveSupport::Duration) }
1159
- def hour; end
1160
-
1161
- sig { returns(ActiveSupport::Duration) }
1162
- def hours; end
1163
-
1164
- sig { returns(ActiveSupport::Duration) }
1165
- def day; end
1166
-
1167
- sig { returns(ActiveSupport::Duration) }
1168
- def days; end
1169
-
1170
- sig { returns(ActiveSupport::Duration) }
1171
- def week; end
1172
-
1173
- sig { returns(ActiveSupport::Duration) }
1174
- def weeks; end
1175
-
1176
- sig { returns(ActiveSupport::Duration) }
1177
- def fortnight; end
1178
-
1179
- sig { returns(ActiveSupport::Duration) }
1180
- def fortnights; end
1181
-
1182
- sig { returns(T.self_type) }
1183
- def in_milliseconds; end
1184
-
1185
- KILOBYTE = T.let(1024, Integer)
1186
- MEGABYTE = T.let(KILOBYTE * 1024, Integer)
1187
- GIGABYTE = T.let(MEGABYTE * 1024, Integer)
1188
- TERABYTE = T.let(GIGABYTE * 1024, Integer)
1189
- PETABYTE = T.let(TERABYTE * 1024, Integer)
1190
- EXABYTE = T.let(PETABYTE * 1024, Integer)
1191
-
1192
- # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
1193
- #
1194
- # ```ruby
1195
- # 2.bytes # => 2
1196
- # ```
1197
- sig { returns(T.self_type) }
1198
- def byte; end
1199
-
1200
- # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
1201
- #
1202
- # ```ruby
1203
- # 2.bytes # => 2
1204
- # ```
1205
- sig { returns(T.self_type) }
1206
- def bytes; end
1207
-
1208
- # Returns the number of bytes equivalent to the kilobytes provided.
1209
- #
1210
- # ```ruby
1211
- # 2.kilobytes # => 2048
1212
- # ```
1213
- sig { returns(T.self_type) }
1214
- def kilobyte; end
1215
-
1216
- # Returns the number of bytes equivalent to the kilobytes provided.
1217
- #
1218
- # ```ruby
1219
- # 2.kilobytes # => 2048
1220
- # ```
1221
- sig { returns(T.self_type) }
1222
- def kilobytes; end
1223
-
1224
- # Returns the number of bytes equivalent to the megabytes provided.
1225
- #
1226
- # ```ruby
1227
- # 2.megabytes # => 2_097_152
1228
- # ```
1229
- sig { returns(T.self_type) }
1230
- def megabyte; end
1231
-
1232
- # Returns the number of bytes equivalent to the megabytes provided.
1233
- #
1234
- # ```ruby
1235
- # 2.megabytes # => 2_097_152
1236
- # ```
1237
- sig { returns(T.self_type) }
1238
- def megabytes; end
1239
-
1240
- # Returns the number of bytes equivalent to the gigabytes provided.
1241
- #
1242
- # ```ruby
1243
- # 2.gigabytes # => 2_147_483_648
1244
- # ```
1245
- sig { returns(T.self_type) }
1246
- def gigabyte; end
1247
-
1248
- # Returns the number of bytes equivalent to the gigabytes provided.
1249
- #
1250
- # ```ruby
1251
- # 2.gigabytes # => 2_147_483_648
1252
- # ```
1253
- sig { returns(T.self_type) }
1254
- def gigabytes; end
1255
-
1256
- # Returns the number of bytes equivalent to the terabytes provided.
1257
- #
1258
- # ```ruby
1259
- # 2.terabytes # => 2_199_023_255_552
1260
- # ```
1261
- sig { returns(T.self_type) }
1262
- def terabyte; end
1263
-
1264
- # Returns the number of bytes equivalent to the terabytes provided.
1265
- #
1266
- # ```ruby
1267
- # 2.terabytes # => 2_199_023_255_552
1268
- # ```
1269
- sig { returns(T.self_type) }
1270
- def terabytes; end
1271
-
1272
- # Returns the number of bytes equivalent to the petabytes provided.
1273
- #
1274
- # ```ruby
1275
- # 2.petabytes # => 2_251_799_813_685_248
1276
- # ```
1277
- sig { returns(T.self_type) }
1278
- def petabyte; end
1279
-
1280
- # Returns the number of bytes equivalent to the petabytes provided.
1281
- #
1282
- # ```ruby
1283
- # 2.petabytes # => 2_251_799_813_685_248
1284
- # ```
1285
- sig { returns(T.self_type) }
1286
- def petabytes; end
1287
-
1288
- # Returns the number of bytes equivalent to the exabytes provided.
1289
- #
1290
- # ```ruby
1291
- # 2.exabytes # => 2_305_843_009_213_693_952
1292
- # ```
1293
- sig { returns(T.self_type) }
1294
- def exabyte; end
1295
-
1296
- # Returns the number of bytes equivalent to the exabytes provided.
1297
- #
1298
- # ```ruby
1299
- # 2.exabytes # => 2_305_843_009_213_693_952
1300
- # ```
1301
- sig { returns(T.self_type) }
1302
- def exabytes; end
1303
- end
1304
-
1305
- module Enumerable
1306
- # https://github.com/rails/rails/blob/v5.2.3/activesupport/lib/active_support/core_ext/enumerable.rb#L64..L72
1307
- # the case where a block isn't given isn't handled - that seems like an unlikely case
1308
- sig do
1309
- type_parameters(:key).params(
1310
- block: T.proc.params(o: Enumerable::Elem).returns(T.type_parameter(:key))
1311
- ).returns(
1312
- T::Hash[T.type_parameter(:key), Enumerable::Elem]
1313
- )
1314
- end
1315
- def index_by(&block); end
1316
- end
1317
-
1318
- class ActiveSupport::Duration
1319
- # Returns the number of seconds that this Duration represents.
1320
- #
1321
- # ```ruby
1322
- # 1.minute.to_i # => 60
1323
- # 1.hour.to_i # => 3600
1324
- # 1.day.to_i # => 86400
1325
- # ```
1326
- #
1327
- # Note that this conversion makes some assumptions about the
1328
- # duration of some periods, e.g. months are always 1/12 of year
1329
- # and years are 365.2425 days:
1330
- #
1331
- # ```ruby
1332
- # # equivalent to (1.year / 12).to_i
1333
- # 1.month.to_i # => 2629746
1334
- #
1335
- # # equivalent to 365.2425.days.to_i
1336
- # 1.year.to_i # => 31556952
1337
- # ```
1338
- #
1339
- # In such cases, Ruby's core
1340
- # [Date](https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html) and
1341
- # [Time](https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html) should be used for precision
1342
- # date and time arithmetic.
1343
- sig { returns(Integer) }
1344
- def to_i; end
1345
-
1346
- sig { returns(Float) }
1347
- def to_f; end
1348
-
1349
- # Returns the amount of seconds a duration covers as a string.
1350
- # For more information check to_i method.
1351
- #
1352
- # ```ruby
1353
- # 1.day.to_s # => "86400"
1354
- # ```
1355
- sig { returns(String) }
1356
- def to_s; end
1357
-
1358
- # Creates a new Duration from string formatted according to ISO 8601 Duration.
1359
- #
1360
- # See [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) for more information.
1361
- # This method allows negative parts to be present in pattern.
1362
- # If invalid string is provided, it will raise `ActiveSupport::Duration::ISO8601Parser::ParsingError`.
1363
- sig { params(iso8601duration: String).returns(ActiveSupport::Duration) }
1364
- def self.parse(iso8601duration); end
1365
-
1366
- # Creates a new Duration from a seconds value that is converted
1367
- # to the individual parts:
1368
- #
1369
- # ```ruby
1370
- # ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
1371
- # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
1372
- # ```
1373
- sig { params(value: Numeric).returns(ActiveSupport::Duration) }
1374
- def self.build(value); end
1375
-
1376
- # Returns `true` if `other` is also a Duration instance, which has the
1377
- # same parts as this one.
1378
- sig { params(other: T.untyped).returns(T::Boolean) }
1379
- def eql?(other); end
1380
-
1381
- # Compares one Duration with another or a Numeric to this Duration.
1382
- # Numeric values are treated as seconds.
1383
- sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(Integer) }
1384
- def <=>(other); end
1385
-
1386
- # Adds another Duration or a Numeric to this Duration. Numeric values
1387
- # are treated as seconds.
1388
- sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
1389
- def +(other); end
1390
-
1391
- # Subtracts another Duration or a Numeric from this Duration. Numeric
1392
- # values are treated as seconds.
1393
- sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
1394
- def -(other); end
1395
-
1396
- # Multiplies this Duration by a Numeric and returns a new Duration.
1397
- sig { params(other: Numeric).returns(ActiveSupport::Duration) }
1398
- def *(other); end
1399
-
1400
- # Divides this Duration by a Numeric and returns a new Duration.
1401
- sig { params(other: Numeric).returns(ActiveSupport::Duration) }
1402
- def /(other); end
1403
-
1404
- # Returns the modulo of this Duration by another Duration or Numeric.
1405
- # Numeric values are treated as seconds.
1406
- sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
1407
- def %(other); end
1408
-
1409
- # Returns `true` if `other` is also a Duration instance with the
1410
- # same `value`, or if `other == value`.
1411
- sig { params(other: T.untyped).returns(T::Boolean) }
1412
- def ==(other); end
1413
-
1414
- # Build ISO 8601 Duration string for this duration.
1415
- # The `precision` parameter can be used to limit seconds' precision of duration.
1416
- sig { params(precision: T.nilable(Integer)).returns(String) }
1417
- def iso8601(precision: nil); end
1418
-
1419
- sig { params(time: T.any(ActiveSupport::TimeWithZone, Date)).returns(ActiveSupport::TimeWithZone) }
1420
- def from_now(time = Time.current); end
1421
-
1422
- sig { params(time: T.any(ActiveSupport::TimeWithZone, Date)).returns(ActiveSupport::TimeWithZone) }
1423
- def ago(time = Time.current); end
1424
- end
1425
-
1426
- module Benchmark
1427
- extend T::Sig
1428
-
1429
- sig { params(block: T.proc.void).returns(Float) }
1430
- def self.ms(&block); end
1431
- end