researchable-freedcamp-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/config +2 -0
- data/.gitignore +1 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/researchable/freedcamp_api/create_task.rb +22 -0
- data/lib/researchable/freedcamp_api/endpoint.rb +34 -0
- data/lib/researchable/freedcamp_api/list_milestones.rb +1 -0
- data/lib/researchable/freedcamp_api/list_projects.rb +1 -0
- data/lib/researchable/freedcamp_api/list_tasks.rb +36 -0
- data/lib/researchable/freedcamp_api/sessions/session.rb +28 -0
- data/lib/researchable/freedcamp_api/sessions/signed_session.rb +128 -0
- data/lib/researchable/freedcamp_api/sessions.rb +17 -0
- data/lib/researchable/freedcamp_api/structs/signature.rb +11 -0
- data/lib/researchable/freedcamp_api/structs/task.rb +48 -0
- data/lib/researchable/freedcamp_api/structs.rb +8 -0
- data/lib/researchable/freedcamp_api/update_task.rb +27 -0
- data/lib/researchable/freedcamp_api/version.rb +8 -0
- data/lib/researchable/freedcamp_api.rb +21 -0
- data/lib/researchable-freedcamp-api.rb +6 -0
- data/output/62d1c67bf1eebc3456f9cc8879519700b2a0fc45 +1 -0
- data/researchable_freedcamp_api.gemspec +44 -0
- data/sorbet/config +3 -0
- data/sorbet/rbi/gems/active_interaction.rbi +304 -0
- data/sorbet/rbi/gems/activemodel.rbi +342 -0
- data/sorbet/rbi/gems/activesupport.rbi +1023 -0
- data/sorbet/rbi/gems/concurrent-ruby.rbi +1662 -0
- data/sorbet/rbi/gems/httparty.rbi +446 -0
- data/sorbet/rbi/gems/i18n.rbi +133 -0
- data/sorbet/rbi/gems/mime-types-data.rbi +17 -0
- data/sorbet/rbi/gems/mime-types.rbi +225 -0
- data/sorbet/rbi/gems/multi_xml.rbi +35 -0
- data/sorbet/rbi/gems/researchable-freedcamp-api.rbi +25 -0
- data/sorbet/rbi/gems/rspec-core.rbi +1915 -0
- data/sorbet/rbi/gems/rspec-expectations.rbi +1151 -0
- data/sorbet/rbi/gems/rspec-mocks.rbi +1110 -0
- data/sorbet/rbi/gems/rspec-support.rbi +280 -0
- data/sorbet/rbi/gems/rspec.rbi +15 -0
- data/sorbet/rbi/gems/tzinfo.rbi +586 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +4251 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +8306 -0
- data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +715 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6/activesupport.rbi +37 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1850 -0
- data/sorbet/rbi/sorbet-typed/lib/httparty/all/httparty.rbi +566 -0
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
- data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +24 -0
- data/sorbet/rbi/todo.rbi +7 -0
- data/test.rb +41 -0
- metadata +198 -0
@@ -0,0 +1,1850 @@
|
|
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: false
|
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 { params(options: T.untyped).returns(T::Hash[String, T.untyped]) }
|
20
|
+
def as_json(options = nil); end
|
21
|
+
|
22
|
+
sig {returns(T::Boolean)}
|
23
|
+
def blank?; end
|
24
|
+
|
25
|
+
sig { returns(T.self_type) }
|
26
|
+
def deep_dup; end
|
27
|
+
|
28
|
+
sig { returns(TrueClass) }
|
29
|
+
def duplicable?; end
|
30
|
+
|
31
|
+
sig { params(another_object: Object).returns(T::Boolean) }
|
32
|
+
def in?(another_object); end
|
33
|
+
|
34
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
35
|
+
def instance_values; end
|
36
|
+
|
37
|
+
sig { returns(T::Array[String]) }
|
38
|
+
def instance_variable_names; end
|
39
|
+
|
40
|
+
sig { returns(T.nilable(T.self_type)) }
|
41
|
+
def presence; end
|
42
|
+
|
43
|
+
sig { returns(T::Boolean) }
|
44
|
+
def present?; end
|
45
|
+
|
46
|
+
def require_dependency(file_name, message = "No such file to load -- %s.rb"); end
|
47
|
+
|
48
|
+
sig { params(options: T.untyped).returns(String) }
|
49
|
+
def to_json(options = nil); end
|
50
|
+
|
51
|
+
sig { returns(String) }
|
52
|
+
def to_param; end
|
53
|
+
|
54
|
+
sig { params(key: String).returns(String) }
|
55
|
+
def to_query(key); end
|
56
|
+
|
57
|
+
sig do
|
58
|
+
params(
|
59
|
+
method_name: T.any(Symbol, String, NilClass),
|
60
|
+
args: T.untyped,
|
61
|
+
b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
62
|
+
).returns(T.untyped)
|
63
|
+
end
|
64
|
+
def try(method_name = nil, *args, &b); end
|
65
|
+
|
66
|
+
sig do
|
67
|
+
params(
|
68
|
+
method_name: T.any(Symbol, String, NilClass),
|
69
|
+
args: T.untyped,
|
70
|
+
b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
71
|
+
).returns(T.untyped)
|
72
|
+
end
|
73
|
+
def try!(method_name = nil, *args, &b); end
|
74
|
+
|
75
|
+
sig do
|
76
|
+
params(
|
77
|
+
options: T::Hash[T.untyped, T.untyped],
|
78
|
+
block: T.nilable(T.proc.returns(T.untyped))
|
79
|
+
).returns(T.untyped)
|
80
|
+
end
|
81
|
+
def with_options(options, &block); end
|
82
|
+
end
|
83
|
+
|
84
|
+
class FalseClass
|
85
|
+
sig { returns(NilClass) }
|
86
|
+
def presence; end
|
87
|
+
end
|
88
|
+
|
89
|
+
class Method
|
90
|
+
sig { returns(FalseClass) }
|
91
|
+
def duplicable?; end
|
92
|
+
end
|
93
|
+
|
94
|
+
class NilClass
|
95
|
+
sig { returns(TrueClass) }
|
96
|
+
def duplicable?; end
|
97
|
+
|
98
|
+
sig { returns(NilClass) }
|
99
|
+
def dup; end
|
100
|
+
|
101
|
+
sig { returns(NilClass) }
|
102
|
+
def deep_dup; end
|
103
|
+
|
104
|
+
sig do
|
105
|
+
params(
|
106
|
+
method_name: T.any(Symbol, String, NilClass),
|
107
|
+
args: T.untyped,
|
108
|
+
b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
109
|
+
).returns(NilClass)
|
110
|
+
end
|
111
|
+
def try(method_name = nil, *args, &b); end
|
112
|
+
|
113
|
+
sig do
|
114
|
+
params(
|
115
|
+
method_name: T.any(Symbol, String, NilClass),
|
116
|
+
args: T.untyped,
|
117
|
+
b: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
118
|
+
).returns(NilClass)
|
119
|
+
end
|
120
|
+
def try!(method_name = nil, *args, &b); end
|
121
|
+
|
122
|
+
sig { returns(NilClass) }
|
123
|
+
def presence; end
|
124
|
+
|
125
|
+
sig { returns(FalseClass) }
|
126
|
+
def present?; end
|
127
|
+
|
128
|
+
sig { returns(TrueClass) }
|
129
|
+
def blank?; end
|
130
|
+
|
131
|
+
sig { returns(NilClass) }
|
132
|
+
def to_param; end
|
133
|
+
end
|
134
|
+
|
135
|
+
class String
|
136
|
+
sig { returns(T::Boolean) }
|
137
|
+
def acts_like_string?; end
|
138
|
+
|
139
|
+
sig { params(position: T.any(Integer, String, Regexp, T::Range[Integer])).returns(T.nilable(String)) }
|
140
|
+
def at(position); end
|
141
|
+
|
142
|
+
sig { returns(T::Boolean) }
|
143
|
+
def blank?; end
|
144
|
+
|
145
|
+
sig { params(first_letter: Symbol).returns(String) }
|
146
|
+
def camelize(first_letter = :upper); end
|
147
|
+
|
148
|
+
# camelcase is an alias of camelize
|
149
|
+
sig { params(first_letter: Symbol).returns(String) }
|
150
|
+
def camelcase(first_letter = :upper); end
|
151
|
+
|
152
|
+
sig { returns(String) }
|
153
|
+
def classify; end
|
154
|
+
|
155
|
+
sig { returns(Module) }
|
156
|
+
def constantize; end
|
157
|
+
|
158
|
+
sig { returns(String) }
|
159
|
+
def dasherize; end
|
160
|
+
|
161
|
+
sig { returns(String) }
|
162
|
+
def deconstantize; end
|
163
|
+
|
164
|
+
sig { returns(String) }
|
165
|
+
def demodulize; end
|
166
|
+
|
167
|
+
# ends_with? is an alias of the core method 'end_with?'
|
168
|
+
sig { params(arg0: String).returns(T::Boolean) }
|
169
|
+
def ends_with?(*arg0); end
|
170
|
+
|
171
|
+
sig { params(string: String).returns(T::Boolean) }
|
172
|
+
def exclude?(string); end
|
173
|
+
|
174
|
+
sig { params(limit: Integer).returns(String) }
|
175
|
+
def first(limit = 1); end
|
176
|
+
|
177
|
+
sig { params(separate_class_name_and_id_with_underscore: T::Boolean).returns(String) }
|
178
|
+
def foreign_key(separate_class_name_and_id_with_underscore = true); end
|
179
|
+
|
180
|
+
sig { params(position: Integer).returns(String) }
|
181
|
+
def from(position); end
|
182
|
+
|
183
|
+
sig { returns(T.untyped) }
|
184
|
+
def html_safe; end
|
185
|
+
|
186
|
+
sig { params(capitalize: T::Boolean, keep_id_suffix: T::Boolean).returns(String) }
|
187
|
+
def humanize(capitalize: true, keep_id_suffix: false); end
|
188
|
+
|
189
|
+
# returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
|
190
|
+
sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
|
191
|
+
def in_time_zone(zone = ::Time.zone); end
|
192
|
+
|
193
|
+
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
194
|
+
def indent!(amount, indent_string = nil, indent_empty_lines = false); end
|
195
|
+
|
196
|
+
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
197
|
+
def indent(amount, indent_string = nil, indent_empty_lines = false); end
|
198
|
+
|
199
|
+
sig { returns(ActiveSupport::StringInquirer) }
|
200
|
+
def inquiry; end
|
201
|
+
|
202
|
+
sig { returns(T::Boolean) }
|
203
|
+
def is_utf8?; end
|
204
|
+
|
205
|
+
sig { params(limit: Integer).returns(String) }
|
206
|
+
def last(limit = 1); end
|
207
|
+
|
208
|
+
sig { returns(ActiveSupport::Multibyte::Chars) }
|
209
|
+
def mb_chars; end
|
210
|
+
|
211
|
+
sig { params(separator: String, preserve_case: T::Boolean, locale: Symbol).returns(String) }
|
212
|
+
def parameterize(separator: "-", preserve_case: false, locale: nil); end
|
213
|
+
|
214
|
+
sig { params(count: T.nilable(Integer), locale: Symbol).returns(String) }
|
215
|
+
def pluralize(count = nil, locale = :en); end
|
216
|
+
|
217
|
+
sig { params(patterns: T.untyped).returns(T.untyped) }
|
218
|
+
def remove!(*patterns); end
|
219
|
+
|
220
|
+
sig { params(patterns: T.untyped).returns(T.untyped) }
|
221
|
+
def remove(*patterns); end
|
222
|
+
|
223
|
+
sig { returns(T.untyped) }
|
224
|
+
def safe_constantize; end
|
225
|
+
|
226
|
+
sig { params(locale: Symbol).returns(String) }
|
227
|
+
def singularize(locale = :en); end
|
228
|
+
|
229
|
+
sig { returns(String) }
|
230
|
+
def squish!; end
|
231
|
+
|
232
|
+
sig { returns(String) }
|
233
|
+
def squish; end
|
234
|
+
|
235
|
+
# starts_with? is an alias of the core method 'start_with?''
|
236
|
+
sig { params(arg0: String).returns(T::Boolean) }
|
237
|
+
def starts_with?(*arg0); end
|
238
|
+
|
239
|
+
sig { returns(String) }
|
240
|
+
def strip_heredoc; end
|
241
|
+
|
242
|
+
sig { returns(String) }
|
243
|
+
def tableize; end
|
244
|
+
|
245
|
+
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
246
|
+
def titleize(keep_id_suffix: false); end
|
247
|
+
|
248
|
+
# titlecase is an alias of titleize
|
249
|
+
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
250
|
+
def titlecase(keep_id_suffix: false); end
|
251
|
+
|
252
|
+
sig { params(position: Integer).returns(String) }
|
253
|
+
def to(position); end
|
254
|
+
|
255
|
+
sig { returns(T.nilable(Date)) }
|
256
|
+
def to_date; end
|
257
|
+
|
258
|
+
sig { returns(T.nilable(DateTime)) }
|
259
|
+
def to_datetime; end
|
260
|
+
|
261
|
+
sig { params(form: Symbol).returns(T.nilable(Time)) }
|
262
|
+
def to_time(form = :local); end
|
263
|
+
|
264
|
+
sig { params(truncate_at: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
265
|
+
def truncate(truncate_at, separator: nil, omission: "..."); end
|
266
|
+
|
267
|
+
sig { params(words_count: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
268
|
+
def truncate_words(words_count, separator: nil, omission: "..."); end
|
269
|
+
|
270
|
+
sig { returns(String) }
|
271
|
+
def underscore; end
|
272
|
+
|
273
|
+
sig { returns(String) }
|
274
|
+
def upcase_first; end
|
275
|
+
end
|
276
|
+
|
277
|
+
class Array
|
278
|
+
sig { returns(T::Boolean) }
|
279
|
+
def blank?; end
|
280
|
+
|
281
|
+
sig { returns(T::Array[T.untyped]) }
|
282
|
+
def deep_dup; end
|
283
|
+
|
284
|
+
sig { returns(T::Hash[T.untyped, T.untyped]) }
|
285
|
+
def extract_options!; end
|
286
|
+
|
287
|
+
sig { returns(T.nilable(Elem)) }
|
288
|
+
def fifth; end
|
289
|
+
|
290
|
+
sig { returns(T.nilable(Elem)) }
|
291
|
+
def forty_two; end
|
292
|
+
|
293
|
+
sig { returns(T.nilable(Elem)) }
|
294
|
+
def fourth; end
|
295
|
+
|
296
|
+
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
297
|
+
def from(position); end
|
298
|
+
|
299
|
+
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
300
|
+
def in_groups(number, fill_with = nil); end
|
301
|
+
|
302
|
+
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
303
|
+
def in_groups_of(number, fill_with = nil); end
|
304
|
+
|
305
|
+
sig { returns(T.untyped) }
|
306
|
+
def inquiry; end
|
307
|
+
|
308
|
+
sig { returns(T.nilable(Elem)) }
|
309
|
+
def second; end
|
310
|
+
|
311
|
+
sig { returns(T.nilable(Elem)) }
|
312
|
+
def second_to_last; end
|
313
|
+
|
314
|
+
sig do
|
315
|
+
params(
|
316
|
+
value: T.untyped,
|
317
|
+
blk: T.proc.params(arg0: Elem).void
|
318
|
+
).returns(T::Array[Elem])
|
319
|
+
end
|
320
|
+
def split(value = nil, &blk); end
|
321
|
+
|
322
|
+
sig { returns(T.nilable(Elem)) }
|
323
|
+
def third; end
|
324
|
+
|
325
|
+
sig { returns(T.nilable(Elem)) }
|
326
|
+
def third_to_last; end
|
327
|
+
|
328
|
+
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
329
|
+
def to(position); end
|
330
|
+
|
331
|
+
# to_default_s is an alias of the core method 'to_s'
|
332
|
+
sig {returns(String)}
|
333
|
+
def to_default_s; end
|
334
|
+
|
335
|
+
sig { params(format: Symbol).returns(String) }
|
336
|
+
def to_formatted_s(format = :default); end
|
337
|
+
|
338
|
+
sig { returns(String) }
|
339
|
+
def to_param; end
|
340
|
+
|
341
|
+
sig { params(key: String).returns(String) }
|
342
|
+
def to_query(key); end
|
343
|
+
|
344
|
+
sig do
|
345
|
+
params(
|
346
|
+
words_connector: String,
|
347
|
+
two_words_connector: String,
|
348
|
+
last_word_connector: String,
|
349
|
+
locale: T.nilable(Symbol)
|
350
|
+
).returns(String)
|
351
|
+
end
|
352
|
+
def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: ", and ", locale: nil); end
|
353
|
+
|
354
|
+
sig { params(options: T.untyped).returns(T.untyped) }
|
355
|
+
def to_xml(options = nil); end
|
356
|
+
|
357
|
+
sig { params(elements: T.untyped).returns(T.untyped) }
|
358
|
+
def without(*elements); end
|
359
|
+
|
360
|
+
sig { params(object: T.untyped).returns(T::Array[T.untyped]) }
|
361
|
+
def self.wrap(object); end
|
362
|
+
end
|
363
|
+
|
364
|
+
class ActiveSupport::BacktraceCleaner
|
365
|
+
sig { params(backtrace: T::Array[String], kind: Symbol).returns(T::Array[String]) }
|
366
|
+
def clean(backtrace, kind = :silent); end
|
367
|
+
end
|
368
|
+
|
369
|
+
module ActiveSupport::NumberHelper
|
370
|
+
extend(::ActiveSupport::NumberHelper)
|
371
|
+
|
372
|
+
sig do
|
373
|
+
params(
|
374
|
+
number: T.any(Numeric, String),
|
375
|
+
locale: Symbol,
|
376
|
+
precision: T.nilable(Integer),
|
377
|
+
unit: String,
|
378
|
+
separator: String,
|
379
|
+
delimiter: String,
|
380
|
+
format: String,
|
381
|
+
negative_format: String
|
382
|
+
).returns(String)
|
383
|
+
end
|
384
|
+
def number_to_currency(number, locale: :en, precision: 2, unit: "$", separator: ".", delimiter: ",", format: "%u%n", negative_format: "-%u%n"); end
|
385
|
+
|
386
|
+
sig do
|
387
|
+
params(
|
388
|
+
number: T.any(Numeric, String),
|
389
|
+
locale: Symbol,
|
390
|
+
delimiter: String,
|
391
|
+
separator: String,
|
392
|
+
delimiter_pattern: T.nilable(Regexp)
|
393
|
+
).returns(String)
|
394
|
+
end
|
395
|
+
def number_to_delimited(number, locale: :en, delimiter: ",", separator: ".", delimiter_pattern: nil); end
|
396
|
+
|
397
|
+
sig do
|
398
|
+
params(
|
399
|
+
number: T.any(Numeric, String),
|
400
|
+
locale: Symbol,
|
401
|
+
precision: T.nilable(Integer),
|
402
|
+
significant: T::Boolean,
|
403
|
+
separator: String,
|
404
|
+
delimiter: String,
|
405
|
+
strip_insignificant_zeros: T::Boolean,
|
406
|
+
units: T.any(T::Hash[T.untyped, T.untyped], String, Symbol),
|
407
|
+
format: String
|
408
|
+
).returns(String)
|
409
|
+
end
|
410
|
+
def number_to_human(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true, units: {}, format: "%n %u"); end
|
411
|
+
|
412
|
+
sig do
|
413
|
+
params(
|
414
|
+
number: T.any(Numeric, String),
|
415
|
+
locale: Symbol,
|
416
|
+
precision: T.nilable(Integer),
|
417
|
+
significant: T::Boolean,
|
418
|
+
separator: String,
|
419
|
+
delimiter: String,
|
420
|
+
strip_insignificant_zeros: T::Boolean
|
421
|
+
).returns(String)
|
422
|
+
end
|
423
|
+
def number_to_human_size(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true); end
|
424
|
+
|
425
|
+
sig do
|
426
|
+
params(
|
427
|
+
number: T.any(Numeric, String),
|
428
|
+
locale: Symbol,
|
429
|
+
precision: T.nilable(Integer),
|
430
|
+
significant: T::Boolean,
|
431
|
+
separator: String,
|
432
|
+
delimiter: String,
|
433
|
+
strip_insignificant_zeros: T::Boolean,
|
434
|
+
format: String
|
435
|
+
).returns(String)
|
436
|
+
end
|
437
|
+
def number_to_percentage(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false, format: "%n%"); end
|
438
|
+
|
439
|
+
sig do
|
440
|
+
params(
|
441
|
+
number: T.any(Numeric, String),
|
442
|
+
area_code: T::Boolean,
|
443
|
+
delimiter: String,
|
444
|
+
extension: T.nilable(Integer),
|
445
|
+
country_code: T.nilable(Integer),
|
446
|
+
pattern: T.nilable(Regexp)
|
447
|
+
).returns(String)
|
448
|
+
end
|
449
|
+
def number_to_phone(number, area_code: false, delimiter: "-", extension: nil, country_code: nil, pattern: nil); end
|
450
|
+
|
451
|
+
sig do
|
452
|
+
params(
|
453
|
+
number: T.any(Numeric, String),
|
454
|
+
locale: Symbol,
|
455
|
+
precision: T.nilable(Integer),
|
456
|
+
significant: T::Boolean,
|
457
|
+
separator: String,
|
458
|
+
delimiter: String,
|
459
|
+
strip_insignificant_zeros: T::Boolean
|
460
|
+
).returns(String)
|
461
|
+
end
|
462
|
+
def number_to_rounded(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false); end
|
463
|
+
end
|
464
|
+
|
465
|
+
module ActiveSupport::Inflector
|
466
|
+
extend(::ActiveSupport::Inflector)
|
467
|
+
|
468
|
+
sig do
|
469
|
+
params(
|
470
|
+
term: String,
|
471
|
+
uppercase_first_letter: T::Boolean
|
472
|
+
).returns(String)
|
473
|
+
end
|
474
|
+
def camelize(term, uppercase_first_letter = true); end
|
475
|
+
|
476
|
+
sig { params(table_name: String).returns(String) }
|
477
|
+
def classify(table_name); end
|
478
|
+
|
479
|
+
sig { params(camel_cased_word: String).returns(T.untyped) }
|
480
|
+
def constantize(camel_cased_word); end
|
481
|
+
|
482
|
+
sig { params(underscored_word: String).returns(String) }
|
483
|
+
def dasherize(underscored_word); end
|
484
|
+
|
485
|
+
sig { params(path: String).returns(String) }
|
486
|
+
def deconstantize(path); end
|
487
|
+
|
488
|
+
sig { params(path: String).returns(String) }
|
489
|
+
def demodulize(path); end
|
490
|
+
|
491
|
+
sig do
|
492
|
+
params(
|
493
|
+
class_name: String,
|
494
|
+
separate_class_name_and_id_with_underscore: T::Boolean
|
495
|
+
).returns(String)
|
496
|
+
end
|
497
|
+
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true); end
|
498
|
+
|
499
|
+
sig do
|
500
|
+
params(
|
501
|
+
lower_case_and_underscored_word: String,
|
502
|
+
capitalize: T::Boolean,
|
503
|
+
keep_id_suffix: T::Boolean
|
504
|
+
).returns(String)
|
505
|
+
end
|
506
|
+
def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false); end
|
507
|
+
|
508
|
+
sig { params(locale: Symbol, blk: T.untyped).returns(T.untyped) }
|
509
|
+
def inflections(locale = :en, &blk); end
|
510
|
+
|
511
|
+
sig { params(number: Integer).returns(String) }
|
512
|
+
def ordinal(number); end
|
513
|
+
|
514
|
+
sig { params(number: Integer).returns(String) }
|
515
|
+
def ordinalize(number); end
|
516
|
+
|
517
|
+
sig do
|
518
|
+
params(
|
519
|
+
string: String,
|
520
|
+
separator: String,
|
521
|
+
preserve_case: T::Boolean,
|
522
|
+
locale: Symbol
|
523
|
+
).returns(String)
|
524
|
+
end
|
525
|
+
def parameterize(string, separator: '-', preserve_case: false, locale: nil); end
|
526
|
+
|
527
|
+
sig { params(word: String, locale: Symbol).returns(String) }
|
528
|
+
def pluralize(word, locale = :en); end
|
529
|
+
|
530
|
+
sig { params(camel_cased_word: String).returns(T.untyped) }
|
531
|
+
def safe_constantize(camel_cased_word); end
|
532
|
+
|
533
|
+
sig { params(word: String, locale: Symbol).returns(String) }
|
534
|
+
def singularize(word, locale = :en); end
|
535
|
+
|
536
|
+
sig { params(class_name: String).returns(String) }
|
537
|
+
def tableize(class_name); end
|
538
|
+
|
539
|
+
sig { params(word: String, keep_id_suffix: T::Boolean).returns(String) }
|
540
|
+
def titleize(word, keep_id_suffix: false); end
|
541
|
+
|
542
|
+
sig { params(string: String, replacement: String, locale: Symbol).returns(String) }
|
543
|
+
def transliterate(string, replacement = '?', locale: nil); end
|
544
|
+
|
545
|
+
sig { params(camel_cased_word: String).returns(String) }
|
546
|
+
def underscore(camel_cased_word); end
|
547
|
+
|
548
|
+
sig { params(string: String).returns(String) }
|
549
|
+
def upcase_first(string); end
|
550
|
+
end
|
551
|
+
|
552
|
+
class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions
|
553
|
+
K = type_member(fixed: T.untyped)
|
554
|
+
V = type_member(fixed: T.untyped)
|
555
|
+
Elem = type_member(fixed: T.untyped)
|
556
|
+
|
557
|
+
def initialize(parent = T.unsafe(nil)); end
|
558
|
+
|
559
|
+
def inheritable_copy; end
|
560
|
+
end
|
561
|
+
|
562
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time/calculations.rb
|
563
|
+
# 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
|
564
|
+
# this is not a complete definition!
|
565
|
+
class ActiveSupport::TimeWithZone
|
566
|
+
include(::DateAndTime::Calculations)
|
567
|
+
|
568
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
569
|
+
def midnight; end
|
570
|
+
|
571
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
572
|
+
def beginning_of_day; end
|
573
|
+
|
574
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
575
|
+
def at_midnight; end
|
576
|
+
|
577
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
578
|
+
def at_beginning_of_day; end
|
579
|
+
|
580
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
581
|
+
def middle_of_day; end
|
582
|
+
|
583
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
584
|
+
def midday; end
|
585
|
+
|
586
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
587
|
+
def noon; end
|
588
|
+
|
589
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
590
|
+
def at_midday; end
|
591
|
+
|
592
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
593
|
+
def at_noon; end
|
594
|
+
|
595
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
596
|
+
def at_middle_of_day; end
|
597
|
+
|
598
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
599
|
+
def end_of_day; end
|
600
|
+
|
601
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
602
|
+
def at_end_of_day; end
|
603
|
+
|
604
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
605
|
+
def end_of_year; end
|
606
|
+
|
607
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
608
|
+
def at_end_of_year; end
|
609
|
+
|
610
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
611
|
+
def beginning_of_year; end
|
612
|
+
|
613
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
614
|
+
def at_beginning_of_year; end
|
615
|
+
|
616
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
617
|
+
def end_of_month; end
|
618
|
+
|
619
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
620
|
+
def at_end_of_month; end
|
621
|
+
|
622
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
623
|
+
def beginning_of_month; end
|
624
|
+
|
625
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
626
|
+
def at_beginning_of_month; end
|
627
|
+
|
628
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
629
|
+
def end_of_hour; end
|
630
|
+
|
631
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
632
|
+
def at_end_of_hour; end
|
633
|
+
|
634
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
635
|
+
def beginning_of_hour; end
|
636
|
+
|
637
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
638
|
+
def at_beginning_of_hour; end
|
639
|
+
|
640
|
+
# Returns a `Time` instance that represents the time in `time_zone`.
|
641
|
+
sig { returns(Time) }
|
642
|
+
def time; end
|
643
|
+
|
644
|
+
# Returns a `Time` instance of the simultaneous time in the UTC timezone.
|
645
|
+
sig { returns(Time) }
|
646
|
+
def utc; end
|
647
|
+
|
648
|
+
# Returns the underlying TZInfo::TimezonePeriod.
|
649
|
+
sig { returns(TZInfo::TimezonePeriod) }
|
650
|
+
def period; end
|
651
|
+
|
652
|
+
# Returns the simultaneous time in `Time.zone`, or the specified zone.
|
653
|
+
sig { params(new_zone: T.untyped).returns(ActiveSupport::TimeWithZone) }
|
654
|
+
def in_time_zone(new_zone = ::Time.zone); end
|
655
|
+
|
656
|
+
# Returns a `Time` instance of the simultaneous time in the system timezone.
|
657
|
+
sig { params(utc_offset: T.untyped).returns(Time) }
|
658
|
+
def localtime(utc_offset = nil); end
|
659
|
+
|
660
|
+
### The following methods are generated dynamically and call to the corresponding Time methods.
|
661
|
+
|
662
|
+
sig { returns(Integer) }
|
663
|
+
def year; end
|
664
|
+
|
665
|
+
sig { returns(Integer) }
|
666
|
+
def mon; end
|
667
|
+
|
668
|
+
sig { returns(Integer) }
|
669
|
+
def month; end
|
670
|
+
|
671
|
+
sig { returns(Integer) }
|
672
|
+
def day; end
|
673
|
+
|
674
|
+
sig { returns(Integer) }
|
675
|
+
def mday; end
|
676
|
+
|
677
|
+
sig { returns(Integer) }
|
678
|
+
def wday; end
|
679
|
+
|
680
|
+
sig { returns(Integer) }
|
681
|
+
def yday; end
|
682
|
+
|
683
|
+
sig { returns(Integer) }
|
684
|
+
def hour; end
|
685
|
+
|
686
|
+
sig { returns(Integer) }
|
687
|
+
def min; end
|
688
|
+
|
689
|
+
sig { returns(Integer) }
|
690
|
+
def sec; end
|
691
|
+
|
692
|
+
sig { returns(Numeric) }
|
693
|
+
def usec; end
|
694
|
+
|
695
|
+
sig { returns(Numeric) }
|
696
|
+
def nsec; end
|
697
|
+
|
698
|
+
### End dynamically-generated methods
|
699
|
+
|
700
|
+
# Returns true if the current time is within Daylight Savings Time for the
|
701
|
+
# specified time zone.
|
702
|
+
#
|
703
|
+
# ```ruby
|
704
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
705
|
+
# Time.zone.parse("2012-5-30").dst? # => true
|
706
|
+
# Time.zone.parse("2012-11-30").dst? # => false
|
707
|
+
# ```
|
708
|
+
sig { returns(T::Boolean) }
|
709
|
+
def dst?; end
|
710
|
+
|
711
|
+
# Returns true if the current time zone is set to UTC.
|
712
|
+
#
|
713
|
+
# ```ruby
|
714
|
+
# Time.zone = 'UTC' # => 'UTC'
|
715
|
+
# Time.zone.now.utc? # => true
|
716
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
717
|
+
# Time.zone.now.utc? # => false
|
718
|
+
# ```
|
719
|
+
sig { returns(T::Boolean) }
|
720
|
+
def utc?; end
|
721
|
+
|
722
|
+
# Returns the offset from current time to UTC time in seconds.
|
723
|
+
sig { returns(Integer) }
|
724
|
+
def utc_offset; end
|
725
|
+
|
726
|
+
# Returns a formatted string of the offset from UTC, or an alternative
|
727
|
+
# string if the time zone is already UTC.
|
728
|
+
#
|
729
|
+
# ```ruby
|
730
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
|
731
|
+
# Time.zone.now.formatted_offset(true) # => "-05:00"
|
732
|
+
# Time.zone.now.formatted_offset(false) # => "-0500"
|
733
|
+
# Time.zone = 'UTC' # => "UTC"
|
734
|
+
# Time.zone.now.formatted_offset(true, "0") # => "0"
|
735
|
+
# ```
|
736
|
+
sig { params(colon: T::Boolean, alternate_utc_string: T.untyped).returns(String) }
|
737
|
+
def formatted_offset(colon = true, alternate_utc_string = nil); end
|
738
|
+
|
739
|
+
# Returns the time zone abbreviation.
|
740
|
+
#
|
741
|
+
# ```ruby
|
742
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
|
743
|
+
# Time.zone.now.zone # => "EST"
|
744
|
+
# ```
|
745
|
+
sig { returns(String) }
|
746
|
+
def zone; end
|
747
|
+
|
748
|
+
# Returns a string of the object's date, time, zone, and offset from UTC.
|
749
|
+
#
|
750
|
+
# ```ruby
|
751
|
+
# Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25 EST -05:00"
|
752
|
+
# ```
|
753
|
+
sig { returns(String) }
|
754
|
+
def inspect; end
|
755
|
+
|
756
|
+
# Returns a string of the object's date and time in the ISO 8601 standard
|
757
|
+
# format.
|
758
|
+
#
|
759
|
+
# ```ruby
|
760
|
+
# Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
|
761
|
+
# ```
|
762
|
+
sig { params(fraction_digits: Integer).returns(String) }
|
763
|
+
def xmlschema(fraction_digits = 0); end
|
764
|
+
|
765
|
+
# Returns a string of the object's date and time in the format used by
|
766
|
+
# HTTP requests.
|
767
|
+
#
|
768
|
+
# ```ruby
|
769
|
+
# Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT"
|
770
|
+
# ```
|
771
|
+
sig { returns(String) }
|
772
|
+
def httpdate; end
|
773
|
+
|
774
|
+
# Returns a string of the object's date and time in the RFC 2822 standard
|
775
|
+
# format.
|
776
|
+
#
|
777
|
+
# ```ruby
|
778
|
+
# Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
|
779
|
+
# ```
|
780
|
+
sig { returns(String) }
|
781
|
+
def rfc2822; end
|
782
|
+
|
783
|
+
# Returns a string of the object's date and time.
|
784
|
+
# Accepts an optional `format`:
|
785
|
+
# * `:default` - default value, mimics Ruby Time#to_s format.
|
786
|
+
# * `:db` - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
|
787
|
+
# * Any key in `Time::DATE_FORMATS` can be used. See active_support/core_ext/time/conversions.rb.
|
788
|
+
sig { params(format: Symbol).returns(String) }
|
789
|
+
def to_s(format = :default); end
|
790
|
+
|
791
|
+
# Replaces `%Z` directive with +zone before passing to Time#strftime,
|
792
|
+
# so that zone information is correct.
|
793
|
+
sig { params(format: String).returns(String) }
|
794
|
+
def strftime(format); end
|
795
|
+
|
796
|
+
# Returns true if the current object's time is within the specified
|
797
|
+
# `min` and `max` time.
|
798
|
+
sig { params(min: T.untyped, max: T.untyped).returns(T::Boolean) }
|
799
|
+
def between?(min, max); end
|
800
|
+
|
801
|
+
# Returns true if the current object's time is in the past.
|
802
|
+
sig { returns(T::Boolean) }
|
803
|
+
def past?; end
|
804
|
+
|
805
|
+
# Returns true if the current object's time falls within
|
806
|
+
# the current day.
|
807
|
+
sig { returns(T::Boolean) }
|
808
|
+
def today?; end
|
809
|
+
|
810
|
+
# Returns true if the current object's time is in the future.
|
811
|
+
sig { returns(T::Boolean) }
|
812
|
+
def future?; end
|
813
|
+
|
814
|
+
# Returns `true` if `other` is equal to current object.
|
815
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
816
|
+
def eql?(other); end
|
817
|
+
|
818
|
+
# Adds an interval of time to the current object's time and returns that
|
819
|
+
# value as a new TimeWithZone object.
|
820
|
+
#
|
821
|
+
# ```ruby
|
822
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
823
|
+
# now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
|
824
|
+
# now + 1000 # => Sun, 02 Nov 2014 01:43:08 EDT -04:00
|
825
|
+
# ```
|
826
|
+
#
|
827
|
+
# If we're adding a Duration of variable length (i.e., years, months, days),
|
828
|
+
# move forward from #time, otherwise move forward from #utc, for accuracy
|
829
|
+
# when moving across DST boundaries.
|
830
|
+
#
|
831
|
+
# For instance, a time + 24.hours will advance exactly 24 hours, while a
|
832
|
+
# time + 1.day will advance 23-25 hours, depending on the day.
|
833
|
+
#
|
834
|
+
# ```ruby
|
835
|
+
# now + 24.hours # => Mon, 03 Nov 2014 00:26:28 EST -05:00
|
836
|
+
# now + 1.day # => Mon, 03 Nov 2014 01:26:28 EST -05:00
|
837
|
+
# ```
|
838
|
+
sig { params(other: T.untyped).returns(ActiveSupport::TimeWithZone) }
|
839
|
+
def +(other); end
|
840
|
+
|
841
|
+
# Subtracts an interval of time and returns a new TimeWithZone object unless
|
842
|
+
# the other value `acts_like?` time. Then it will return a Float of the difference
|
843
|
+
# between the two times that represents the difference between the current
|
844
|
+
# object's time and the `other` time.
|
845
|
+
#
|
846
|
+
# ```ruby
|
847
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
848
|
+
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00
|
849
|
+
# now - 1000 # => Mon, 03 Nov 2014 00:09:48 EST -05:00
|
850
|
+
# ```
|
851
|
+
#
|
852
|
+
# If subtracting a Duration of variable length (i.e., years, months, days),
|
853
|
+
# move backward from #time, otherwise move backward from #utc, for accuracy
|
854
|
+
# when moving across DST boundaries.
|
855
|
+
#
|
856
|
+
# For instance, a time - 24.hours will go subtract exactly 24 hours, while a
|
857
|
+
# time - 1.day will subtract 23-25 hours, depending on the day.
|
858
|
+
#
|
859
|
+
# ```ruby
|
860
|
+
# now - 24.hours # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
|
861
|
+
# now - 1.day # => Sun, 02 Nov 2014 00:26:28 EDT -04:00
|
862
|
+
# ```
|
863
|
+
#
|
864
|
+
# If both the TimeWithZone object and the other value act like Time, a Float
|
865
|
+
# will be returned.
|
866
|
+
#
|
867
|
+
# ```ruby
|
868
|
+
# Time.zone.now - 1.day.ago # => 86399.999967
|
869
|
+
# ```
|
870
|
+
sig { params(other: T.untyped).returns(T.any(ActiveSupport::TimeWithZone, Float)) }
|
871
|
+
def -(other); end
|
872
|
+
|
873
|
+
# Subtracts an interval of time from the current object's time and returns
|
874
|
+
# the result as a new TimeWithZone object.
|
875
|
+
#
|
876
|
+
# ```ruby
|
877
|
+
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
878
|
+
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00
|
879
|
+
# now.ago(1000) # => Mon, 03 Nov 2014 00:09:48 EST -05:00
|
880
|
+
# ```
|
881
|
+
#
|
882
|
+
# If we're subtracting a Duration of variable length (i.e., years, months,
|
883
|
+
# days), move backward from #time, otherwise move backward from #utc, for
|
884
|
+
# accuracy when moving across DST boundaries.
|
885
|
+
#
|
886
|
+
# For instance, `time.ago(24.hours)` will move back exactly 24 hours,
|
887
|
+
# while `time.ago(1.day)` will move back 23-25 hours, depending on
|
888
|
+
# the day.
|
889
|
+
#
|
890
|
+
# ```ruby
|
891
|
+
# now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
|
892
|
+
# now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28 EDT -04:00
|
893
|
+
# ```
|
894
|
+
sig { params(other: T.any(Numeric, ActiveSupport::Duration)).returns(ActiveSupport::TimeWithZone) }
|
895
|
+
def ago(other); end
|
896
|
+
|
897
|
+
# Returns Array of parts of Time in sequence of
|
898
|
+
# [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone].
|
899
|
+
#
|
900
|
+
# ```ruby
|
901
|
+
# now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27 UTC +00:00
|
902
|
+
# now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"]
|
903
|
+
# ```
|
904
|
+
sig { returns([Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, T::Boolean, String]) }
|
905
|
+
def to_a; end
|
906
|
+
|
907
|
+
# Returns the object's date and time as a floating point number of seconds
|
908
|
+
# since the Epoch (January 1, 1970 00:00 UTC).
|
909
|
+
#
|
910
|
+
# ```ruby
|
911
|
+
# Time.zone.now.to_f # => 1417709320.285418
|
912
|
+
# ```
|
913
|
+
sig { returns(Float) }
|
914
|
+
def to_f; end
|
915
|
+
|
916
|
+
# Returns the object's date and time as an integer number of seconds
|
917
|
+
# since the Epoch (January 1, 1970 00:00 UTC).
|
918
|
+
#
|
919
|
+
# ```ruby
|
920
|
+
# Time.zone.now.to_i # => 1417709320
|
921
|
+
# ```
|
922
|
+
sig { returns(Integer) }
|
923
|
+
def to_i; end
|
924
|
+
|
925
|
+
# Returns the object's date and time as a rational number of seconds
|
926
|
+
# since the Epoch (January 1, 1970 00:00 UTC).
|
927
|
+
#
|
928
|
+
# ```ruby
|
929
|
+
# Time.zone.now.to_r # => (708854548642709/500000)
|
930
|
+
# ```
|
931
|
+
sig { returns(Rational) }
|
932
|
+
def to_r; end
|
933
|
+
|
934
|
+
sig { returns(Date) }
|
935
|
+
def to_date; end
|
936
|
+
|
937
|
+
# Returns an instance of DateTime with the timezone's UTC offset
|
938
|
+
#
|
939
|
+
# ```ruby
|
940
|
+
# Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000
|
941
|
+
# Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000
|
942
|
+
# ```
|
943
|
+
sig { returns(DateTime) }
|
944
|
+
def to_datetime; end
|
945
|
+
|
946
|
+
# Returns an instance of `Time`, either with the same UTC offset
|
947
|
+
# as `self` or in the local system timezone depending on the setting
|
948
|
+
# of `ActiveSupport.to_time_preserves_timezone`.
|
949
|
+
sig { returns(Time) }
|
950
|
+
def to_time; end
|
951
|
+
|
952
|
+
# Uses Date to provide precise Time calculations for years, months, and days according to the proleptic Gregorian calendar.
|
953
|
+
# The result is returned as a new `TimeWithZone` object.
|
954
|
+
# The options parameter takes a hash with any of these keys: :years, :months, :weeks, :days, :hours, :minutes, :seconds.
|
955
|
+
# If advancing by a value of variable length (i.e., years, weeks, months, days), move forward from `time`, otherwise move forward
|
956
|
+
# from utc, for accuracy when moving across DST boundaries.
|
957
|
+
sig { params(options: T::Hash[Symbol, Numeric]).returns(ActiveSupport::TimeWithZone) }
|
958
|
+
def advance(options); end
|
959
|
+
|
960
|
+
sig { params(options: T::Hash[Symbol, T.untyped]).returns(ActiveSupport::TimeWithZone) }
|
961
|
+
def change(options); end
|
962
|
+
end
|
963
|
+
|
964
|
+
module DateAndTime::Calculations
|
965
|
+
sig { params(date_or_time: T.any(Date, Time, DateTime)).returns(T::Boolean) }
|
966
|
+
def after?(date_or_time); end
|
967
|
+
|
968
|
+
# Would ideally be typed as returning T::Range[T.self_type] but
|
969
|
+
# it looks like you can't have T.self_type inside a generic.
|
970
|
+
def all_day; end
|
971
|
+
def all_month; end
|
972
|
+
def all_quarter; end
|
973
|
+
def all_week(start_day = T.unsafe(nil)); end
|
974
|
+
def all_year; end
|
975
|
+
|
976
|
+
sig { returns(T.self_type) }
|
977
|
+
def at_beginning_of_month; end
|
978
|
+
|
979
|
+
sig { returns(T.self_type) }
|
980
|
+
def at_beginning_of_quarter; end
|
981
|
+
|
982
|
+
sig { params(start_day: Symbol).returns(T.self_type) }
|
983
|
+
def at_beginning_of_week(start_day = T.unsafe(nil)); end
|
984
|
+
|
985
|
+
sig { returns(T.self_type) }
|
986
|
+
def at_beginning_of_year; end
|
987
|
+
|
988
|
+
sig { returns(T.self_type) }
|
989
|
+
def at_end_of_month; end
|
990
|
+
|
991
|
+
sig { returns(T.self_type) }
|
992
|
+
def at_end_of_quarter; end
|
993
|
+
|
994
|
+
sig { params(start_day: Symbol).returns(T.self_type) }
|
995
|
+
def at_end_of_week(start_day = T.unsafe(nil)); end
|
996
|
+
|
997
|
+
sig { returns(T.self_type) }
|
998
|
+
def at_end_of_year; end
|
999
|
+
|
1000
|
+
sig { params(date_or_time: T.any(Date, Time, DateTime)).returns(T::Boolean) }
|
1001
|
+
def before?(date_or_time); end
|
1002
|
+
|
1003
|
+
sig { returns(T.self_type) }
|
1004
|
+
def beginning_of_month; end
|
1005
|
+
|
1006
|
+
sig { returns(T.self_type) }
|
1007
|
+
def beginning_of_quarter; end
|
1008
|
+
|
1009
|
+
sig { params(start_day: Symbol).returns(T.self_type) }
|
1010
|
+
def beginning_of_week(start_day = T.unsafe(nil)); end
|
1011
|
+
|
1012
|
+
sig { returns(T.self_type) }
|
1013
|
+
def beginning_of_year; end
|
1014
|
+
|
1015
|
+
sig { params(days: Numeric).returns(T.self_type) }
|
1016
|
+
def days_ago(days); end
|
1017
|
+
|
1018
|
+
sig { params(days: Numeric).returns(T.self_type) }
|
1019
|
+
def days_since(days); end
|
1020
|
+
|
1021
|
+
sig { params(start_day: Symbol).returns(T.self_type) }
|
1022
|
+
def days_to_week_start(start_day = T.unsafe(nil)); end
|
1023
|
+
|
1024
|
+
sig { returns(T.self_type) }
|
1025
|
+
def end_of_month; end
|
1026
|
+
|
1027
|
+
sig { returns(T.self_type) }
|
1028
|
+
def end_of_quarter; end
|
1029
|
+
|
1030
|
+
sig { params(start_day: Symbol).returns(T.self_type) }
|
1031
|
+
def end_of_week(start_day = T.unsafe(nil)); end
|
1032
|
+
|
1033
|
+
sig { returns(T.self_type) }
|
1034
|
+
def end_of_year; end
|
1035
|
+
|
1036
|
+
sig { returns(T::Boolean) }
|
1037
|
+
def future?; end
|
1038
|
+
|
1039
|
+
sig { returns(T.self_type) }
|
1040
|
+
def last_month; end
|
1041
|
+
|
1042
|
+
sig { returns(T.self_type) }
|
1043
|
+
def last_quarter; end
|
1044
|
+
|
1045
|
+
sig { params(start_day: Symbol, same_time: T::Boolean).returns(T.self_type) }
|
1046
|
+
def last_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
|
1047
|
+
|
1048
|
+
sig { returns(T.self_type) }
|
1049
|
+
def last_weekday; end
|
1050
|
+
|
1051
|
+
sig { returns(T.self_type) }
|
1052
|
+
def last_year; end
|
1053
|
+
|
1054
|
+
sig { returns(T.self_type) }
|
1055
|
+
def monday; end
|
1056
|
+
|
1057
|
+
sig { params(months: Numeric).returns(T.self_type) }
|
1058
|
+
def months_ago(months); end
|
1059
|
+
|
1060
|
+
sig { params(months: Numeric).returns(T.self_type) }
|
1061
|
+
def months_since(months); end
|
1062
|
+
|
1063
|
+
sig { params(day_of_week: Symbol).returns(T.self_type) }
|
1064
|
+
def next_occurring(day_of_week); end
|
1065
|
+
|
1066
|
+
sig { returns(T.self_type) }
|
1067
|
+
def next_quarter; end
|
1068
|
+
|
1069
|
+
sig { params(given_day_in_next_week: Symbol, same_time: T::Boolean).returns(T.self_type) }
|
1070
|
+
def next_week(given_day_in_next_week = T.unsafe(nil), same_time: T.unsafe(nil)); end
|
1071
|
+
|
1072
|
+
sig { returns(T.self_type) }
|
1073
|
+
def next_weekday; end
|
1074
|
+
|
1075
|
+
sig { returns(T::Boolean) }
|
1076
|
+
def on_weekday?; end
|
1077
|
+
|
1078
|
+
sig { returns(T::Boolean) }
|
1079
|
+
def on_weekend?; end
|
1080
|
+
|
1081
|
+
sig { returns(T::Boolean) }
|
1082
|
+
def past?; end
|
1083
|
+
|
1084
|
+
sig { params(day_of_week: Symbol).returns(T.self_type) }
|
1085
|
+
def prev_occurring(day_of_week); end
|
1086
|
+
|
1087
|
+
sig { returns(T.self_type) }
|
1088
|
+
def prev_quarter; end
|
1089
|
+
|
1090
|
+
sig { params(start_day: Symbol, same_time: T::Boolean).returns(T.self_type) }
|
1091
|
+
def prev_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
|
1092
|
+
|
1093
|
+
sig { returns(T.self_type) }
|
1094
|
+
def prev_weekday; end
|
1095
|
+
|
1096
|
+
sig { returns(T.self_type) }
|
1097
|
+
def sunday; end
|
1098
|
+
|
1099
|
+
sig { returns(T::Boolean) }
|
1100
|
+
def today?; end
|
1101
|
+
|
1102
|
+
sig { returns(T.self_type) }
|
1103
|
+
def tomorrow; end
|
1104
|
+
|
1105
|
+
sig { params(weeks: Numeric).returns(T.self_type) }
|
1106
|
+
def weeks_ago(weeks); end
|
1107
|
+
|
1108
|
+
sig { params(weeks: Numeric).returns(T.self_type) }
|
1109
|
+
def weeks_since(weeks); end
|
1110
|
+
|
1111
|
+
sig { params(years: Numeric).returns(T.self_type) }
|
1112
|
+
def years_ago(years); end
|
1113
|
+
|
1114
|
+
sig { params(years: Numeric).returns(T.self_type) }
|
1115
|
+
def years_since(years); end
|
1116
|
+
|
1117
|
+
sig { returns(T.self_type) }
|
1118
|
+
def yesterday; end
|
1119
|
+
|
1120
|
+
private
|
1121
|
+
|
1122
|
+
def copy_time_to(other); end
|
1123
|
+
def days_span(day); end
|
1124
|
+
def first_hour(date_or_time); end
|
1125
|
+
def last_hour(date_or_time); end
|
1126
|
+
end
|
1127
|
+
|
1128
|
+
DateAndTime::Calculations::DAYS_INTO_WEEK = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
|
1129
|
+
|
1130
|
+
DateAndTime::Calculations::WEEKEND_DAYS = T.let(T.unsafe(nil), T::Array[T.untyped])
|
1131
|
+
|
1132
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date
|
1133
|
+
# this is not a complete definition!
|
1134
|
+
class Date
|
1135
|
+
include(::DateAndTime::Calculations)
|
1136
|
+
|
1137
|
+
DATE_FORMATS = T.let(nil, T::Hash[Symbol, T.untyped])
|
1138
|
+
|
1139
|
+
sig { params(options: T::Hash[Symbol, Integer]).returns(Date) }
|
1140
|
+
def advance(options); end
|
1141
|
+
|
1142
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1143
|
+
def midnight; end
|
1144
|
+
|
1145
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1146
|
+
def beginning_of_day; end
|
1147
|
+
|
1148
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1149
|
+
def at_midnight; end
|
1150
|
+
|
1151
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1152
|
+
def at_beginning_of_day; end
|
1153
|
+
|
1154
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1155
|
+
def middle_of_day; end
|
1156
|
+
|
1157
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1158
|
+
def midday; end
|
1159
|
+
|
1160
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1161
|
+
def noon; end
|
1162
|
+
|
1163
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1164
|
+
def at_midday; end
|
1165
|
+
|
1166
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1167
|
+
def at_noon; end
|
1168
|
+
|
1169
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1170
|
+
def at_middle_of_day; end
|
1171
|
+
|
1172
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1173
|
+
def at_end_of_day; end
|
1174
|
+
|
1175
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1176
|
+
def end_of_day; end
|
1177
|
+
|
1178
|
+
# these are the sigs for Date- in the stdlib
|
1179
|
+
# https://github.com/sorbet/sorbet/blob/3910f6cfd9935c9b42e2135e32e15ab8a6e5b9be/rbi/stdlib/date.rbi#L373
|
1180
|
+
# note that if more sigs are added to sorbet you should replicate them here
|
1181
|
+
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/date.rbi
|
1182
|
+
sig {params(arg0: Numeric).returns(T.self_type)}
|
1183
|
+
sig {params(arg0: Date).returns(Rational)}
|
1184
|
+
# these sigs are added for activesupport users
|
1185
|
+
sig {params(arg0: ActiveSupport::Duration).returns(T.self_type)}
|
1186
|
+
def -(arg0); end
|
1187
|
+
|
1188
|
+
sig { params(format: Symbol).returns(String) }
|
1189
|
+
def to_formatted_s(format = :default); end
|
1190
|
+
|
1191
|
+
sig { returns(Integer) }
|
1192
|
+
def to_i; end
|
1193
|
+
|
1194
|
+
class << self
|
1195
|
+
sig { returns(T.attached_class) }
|
1196
|
+
def tomorrow; end
|
1197
|
+
|
1198
|
+
sig { returns(T.attached_class) }
|
1199
|
+
def yesterday; end
|
1200
|
+
|
1201
|
+
sig { returns(T.attached_class) }
|
1202
|
+
def current; end
|
1203
|
+
end
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time
|
1207
|
+
# this is not a complete definition!
|
1208
|
+
class Time
|
1209
|
+
include(::DateAndTime::Calculations)
|
1210
|
+
|
1211
|
+
sig { returns(Time) }
|
1212
|
+
def midnight; end
|
1213
|
+
|
1214
|
+
sig { returns(Time) }
|
1215
|
+
def beginning_of_day; end
|
1216
|
+
|
1217
|
+
sig { params(options: T::Hash[Symbol, Integer]).returns(Time) }
|
1218
|
+
def advance(options); end
|
1219
|
+
|
1220
|
+
sig { returns(Time) }
|
1221
|
+
def at_midnight; end
|
1222
|
+
|
1223
|
+
sig { returns(Time) }
|
1224
|
+
def at_beginning_of_day; end
|
1225
|
+
|
1226
|
+
sig { returns(Time) }
|
1227
|
+
def middle_of_day; end
|
1228
|
+
|
1229
|
+
sig { returns(Time) }
|
1230
|
+
def midday; end
|
1231
|
+
|
1232
|
+
sig { returns(Time) }
|
1233
|
+
def noon; end
|
1234
|
+
|
1235
|
+
sig { returns(Time) }
|
1236
|
+
def at_midday; end
|
1237
|
+
|
1238
|
+
sig { returns(Time) }
|
1239
|
+
def at_noon; end
|
1240
|
+
|
1241
|
+
sig { returns(Time) }
|
1242
|
+
def at_middle_of_day; end
|
1243
|
+
|
1244
|
+
sig { returns(Time) }
|
1245
|
+
def at_end_of_day; end
|
1246
|
+
|
1247
|
+
sig { returns(Time) }
|
1248
|
+
def end_of_day; end
|
1249
|
+
|
1250
|
+
# https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
|
1251
|
+
# returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
|
1252
|
+
sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
|
1253
|
+
def in_time_zone(zone = ::Time.zone); end
|
1254
|
+
|
1255
|
+
# these are the sigs for Time- in the stdlib
|
1256
|
+
# https://github.com/sorbet/sorbet/blob/c3691753e4ce545e1eb66cbd3e55de67d8879b98/rbi/core/time.rbi#L347
|
1257
|
+
# note that if more sigs are added to sorbet you should replicate them here
|
1258
|
+
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/core/time.rbi#L347
|
1259
|
+
sig do
|
1260
|
+
params(
|
1261
|
+
arg0: Time,
|
1262
|
+
)
|
1263
|
+
.returns(Float)
|
1264
|
+
end
|
1265
|
+
sig do
|
1266
|
+
params(
|
1267
|
+
arg0: Numeric,
|
1268
|
+
)
|
1269
|
+
.returns(Time)
|
1270
|
+
end
|
1271
|
+
# these sigs are added for activesupport users
|
1272
|
+
sig { params(arg0: ActiveSupport::Duration).returns(Time) }
|
1273
|
+
def -(arg0); end
|
1274
|
+
|
1275
|
+
sig { params(format: Symbol).returns(String) }
|
1276
|
+
def to_formatted_s(format = :default); end
|
1277
|
+
|
1278
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1279
|
+
def self.current; end
|
1280
|
+
|
1281
|
+
# Returns the TimeZone for the current request, if this has been set (via Time.zone=).
|
1282
|
+
# If `Time.zone` has not been set for the current request, returns the TimeZone specified in `config.time_zone`.
|
1283
|
+
sig { returns(ActiveSupport::TimeZone) }
|
1284
|
+
def self.zone; end
|
1285
|
+
|
1286
|
+
# Sets `Time.zone` to a TimeZone object for the current request/thread.
|
1287
|
+
#
|
1288
|
+
# This method accepts any of the following:
|
1289
|
+
#
|
1290
|
+
# * A Rails TimeZone object.
|
1291
|
+
# * An identifier for a Rails TimeZone object (e.g., "Eastern Time (US & Canada)", `-5.hours`).
|
1292
|
+
# * A TZInfo::Timezone object.
|
1293
|
+
# * An identifier for a TZInfo::Timezone object (e.g., "America/New_York").
|
1294
|
+
#
|
1295
|
+
# Here's an example of how you might set `Time.zone` on a per request basis and reset it when the request is done.
|
1296
|
+
# `current_user.time_zone` just needs to return a string identifying the user's preferred time zone:
|
1297
|
+
#
|
1298
|
+
# ```ruby
|
1299
|
+
# class ApplicationController < ActionController::Base
|
1300
|
+
# around_action :set_time_zone
|
1301
|
+
#
|
1302
|
+
# def set_time_zone
|
1303
|
+
# if logged_in?
|
1304
|
+
# Time.use_zone(current_user.time_zone) { yield }
|
1305
|
+
# else
|
1306
|
+
# yield
|
1307
|
+
# end
|
1308
|
+
# end
|
1309
|
+
# end
|
1310
|
+
# ```
|
1311
|
+
sig { params(time_zone: T.any(String, TZInfo::Timezone, ActiveSupport::TimeZone, ActiveSupport::Duration)).void }
|
1312
|
+
def self.zone=(time_zone); end
|
1313
|
+
end
|
1314
|
+
|
1315
|
+
class ActiveSupport::TimeZone
|
1316
|
+
# Locate a specific time zone object. If the argument is a string, it
|
1317
|
+
# is interpreted to mean the name of the timezone to locate. If it is a
|
1318
|
+
# numeric value it is either the hour offset, or the second offset, of the
|
1319
|
+
# timezone to find. (The first one with that offset will be returned.)
|
1320
|
+
# Returns `nil` if no such time zone is known to the system.
|
1321
|
+
sig { params(arg: T.any(String, Numeric, ActiveSupport::Duration)).returns(T.nilable(ActiveSupport::TimeZone)) }
|
1322
|
+
def self.[](arg); end
|
1323
|
+
|
1324
|
+
# Returns an array of all TimeZone objects. There are multiple
|
1325
|
+
# TimeZone objects per time zone, in many cases, to make it easier
|
1326
|
+
# for users to find their own time zone.
|
1327
|
+
sig { returns(T::Array[ActiveSupport::TimeZone]) }
|
1328
|
+
def self.all; end
|
1329
|
+
|
1330
|
+
# A convenience method for returning a collection of TimeZone objects
|
1331
|
+
# for time zones in the USA.
|
1332
|
+
sig { returns(T::Array[ActiveSupport::TimeZone]) }
|
1333
|
+
def self.us_zones; end
|
1334
|
+
|
1335
|
+
# A convenience method for returning a collection of TimeZone objects
|
1336
|
+
# for time zones in the country specified by its ISO 3166-1 Alpha2 code.
|
1337
|
+
sig { params(country_code: T.any(String, Symbol)).returns(T::Array[ActiveSupport::TimeZone]) }
|
1338
|
+
def self.country_zones(country_code); end
|
1339
|
+
|
1340
|
+
# Returns an ActiveSupport::TimeWithZone instance representing the current
|
1341
|
+
# time in the time zone represented by `self`.
|
1342
|
+
#
|
1343
|
+
# ```ruby
|
1344
|
+
# Time.zone = 'Hawaii' # => "Hawaii"
|
1345
|
+
# Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
|
1346
|
+
# ```
|
1347
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
1348
|
+
def now; end
|
1349
|
+
|
1350
|
+
# Returns the current date in this time zone.
|
1351
|
+
sig { returns(Date) }
|
1352
|
+
def today; end
|
1353
|
+
|
1354
|
+
# Returns the next date in this time zone.
|
1355
|
+
sig { returns(Date) }
|
1356
|
+
def tomorrow; end
|
1357
|
+
|
1358
|
+
# Returns the previous date in this time zone.
|
1359
|
+
sig { returns(Date) }
|
1360
|
+
def yesterday; end
|
1361
|
+
|
1362
|
+
# Method for creating new ActiveSupport::TimeWithZone instance in time zone
|
1363
|
+
# of `self` from given values.
|
1364
|
+
#
|
1365
|
+
# ```ruby
|
1366
|
+
# Time.zone = 'Hawaii' # => "Hawaii"
|
1367
|
+
# Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00
|
1368
|
+
# ```
|
1369
|
+
sig { params(args: T.untyped).returns(ActiveSupport::TimeWithZone) }
|
1370
|
+
def local(*args); end
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
# defines some of the methods at https://github.com/rails/rails/tree/v6.0.0/activesupport/lib/active_support/core_ext/hash
|
1374
|
+
# this is not a complete definition!
|
1375
|
+
class Hash
|
1376
|
+
sig { params(other_hash: T::Hash[T.untyped, T.untyped]).returns(T::Hash[T.untyped, T.untyped]) }
|
1377
|
+
def deep_merge(other_hash, &block); end
|
1378
|
+
|
1379
|
+
sig { params(keys: T.untyped).returns(T.self_type) }
|
1380
|
+
def except(*keys); end
|
1381
|
+
|
1382
|
+
sig { returns(T::Hash[String, V]) }
|
1383
|
+
def stringify_keys; end
|
1384
|
+
|
1385
|
+
sig { returns(T::Hash[String, V]) }
|
1386
|
+
def stringify_keys!; end
|
1387
|
+
|
1388
|
+
sig { returns(T::Hash[String, V]) }
|
1389
|
+
def deep_stringify_keys; end
|
1390
|
+
|
1391
|
+
sig { returns(T::Hash[String, V]) }
|
1392
|
+
def deep_stringify_keys!; end
|
1393
|
+
|
1394
|
+
sig { returns(T::Hash[Symbol, V]) }
|
1395
|
+
def symbolize_keys; end
|
1396
|
+
|
1397
|
+
sig { returns(T::Hash[Symbol, V]) }
|
1398
|
+
def symbolize_keys!; end
|
1399
|
+
|
1400
|
+
sig { returns(T::Hash[Symbol, V]) }
|
1401
|
+
def deep_symbolize_keys; end
|
1402
|
+
|
1403
|
+
sig { returns(T::Hash[Symbol, V]) }
|
1404
|
+
def deep_symbolize_keys!; end
|
1405
|
+
|
1406
|
+
# in an ideal world, `arg` would be the type of all keys, the 1st `T.untyped` would be
|
1407
|
+
# the type of keys your block returns, and the 2nd `T.untyped` would be the type of values
|
1408
|
+
# that the hash had.
|
1409
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, V]) }
|
1410
|
+
def deep_transform_keys(&block); end
|
1411
|
+
|
1412
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, V]) }
|
1413
|
+
def deep_transform_keys!(&block); end
|
1414
|
+
|
1415
|
+
sig { returns(T::Hash[Symbol, V]) }
|
1416
|
+
def to_options; end
|
1417
|
+
|
1418
|
+
sig { params(namespace: T.untyped).returns(String) }
|
1419
|
+
def to_query(namespace = nil); end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
|
1423
|
+
|
1424
|
+
class Integer
|
1425
|
+
# Returns a Duration instance matching the number of months provided.
|
1426
|
+
#
|
1427
|
+
# ```ruby
|
1428
|
+
# 2.months # => 2 months
|
1429
|
+
# ```
|
1430
|
+
sig { returns(ActiveSupport::Duration) }
|
1431
|
+
def months; end
|
1432
|
+
|
1433
|
+
sig { returns(ActiveSupport::Duration) }
|
1434
|
+
def month; end
|
1435
|
+
|
1436
|
+
# Returns a Duration instance matching the number of years provided.
|
1437
|
+
#
|
1438
|
+
# ```ruby
|
1439
|
+
# 2.years # => 2 years
|
1440
|
+
# ```
|
1441
|
+
sig { returns(ActiveSupport::Duration) }
|
1442
|
+
def years; end
|
1443
|
+
|
1444
|
+
sig { returns(ActiveSupport::Duration) }
|
1445
|
+
def year; end
|
1446
|
+
end
|
1447
|
+
|
1448
|
+
class Numeric
|
1449
|
+
sig { returns(ActiveSupport::Duration) }
|
1450
|
+
def second; end
|
1451
|
+
|
1452
|
+
sig { returns(ActiveSupport::Duration) }
|
1453
|
+
def seconds; end
|
1454
|
+
|
1455
|
+
sig { returns(ActiveSupport::Duration) }
|
1456
|
+
def minute; end
|
1457
|
+
|
1458
|
+
sig { returns(ActiveSupport::Duration) }
|
1459
|
+
def minutes; end
|
1460
|
+
|
1461
|
+
sig { returns(ActiveSupport::Duration) }
|
1462
|
+
def hour; end
|
1463
|
+
|
1464
|
+
sig { returns(ActiveSupport::Duration) }
|
1465
|
+
def hours; end
|
1466
|
+
|
1467
|
+
sig { returns(ActiveSupport::Duration) }
|
1468
|
+
def day; end
|
1469
|
+
|
1470
|
+
sig { returns(ActiveSupport::Duration) }
|
1471
|
+
def days; end
|
1472
|
+
|
1473
|
+
sig { returns(ActiveSupport::Duration) }
|
1474
|
+
def week; end
|
1475
|
+
|
1476
|
+
sig { returns(ActiveSupport::Duration) }
|
1477
|
+
def weeks; end
|
1478
|
+
|
1479
|
+
sig { returns(ActiveSupport::Duration) }
|
1480
|
+
def fortnight; end
|
1481
|
+
|
1482
|
+
sig { returns(ActiveSupport::Duration) }
|
1483
|
+
def fortnights; end
|
1484
|
+
|
1485
|
+
sig { returns(T.self_type) }
|
1486
|
+
def in_milliseconds; end
|
1487
|
+
|
1488
|
+
KILOBYTE = T.let(1024, Integer)
|
1489
|
+
MEGABYTE = T.let(KILOBYTE * 1024, Integer)
|
1490
|
+
GIGABYTE = T.let(MEGABYTE * 1024, Integer)
|
1491
|
+
TERABYTE = T.let(GIGABYTE * 1024, Integer)
|
1492
|
+
PETABYTE = T.let(TERABYTE * 1024, Integer)
|
1493
|
+
EXABYTE = T.let(PETABYTE * 1024, Integer)
|
1494
|
+
|
1495
|
+
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
1496
|
+
#
|
1497
|
+
# ```ruby
|
1498
|
+
# 2.bytes # => 2
|
1499
|
+
# ```
|
1500
|
+
sig { returns(T.self_type) }
|
1501
|
+
def byte; end
|
1502
|
+
|
1503
|
+
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
1504
|
+
#
|
1505
|
+
# ```ruby
|
1506
|
+
# 2.bytes # => 2
|
1507
|
+
# ```
|
1508
|
+
sig { returns(T.self_type) }
|
1509
|
+
def bytes; end
|
1510
|
+
|
1511
|
+
# Returns the number of bytes equivalent to the kilobytes provided.
|
1512
|
+
#
|
1513
|
+
# ```ruby
|
1514
|
+
# 2.kilobytes # => 2048
|
1515
|
+
# ```
|
1516
|
+
sig { returns(T.self_type) }
|
1517
|
+
def kilobyte; end
|
1518
|
+
|
1519
|
+
# Returns the number of bytes equivalent to the kilobytes provided.
|
1520
|
+
#
|
1521
|
+
# ```ruby
|
1522
|
+
# 2.kilobytes # => 2048
|
1523
|
+
# ```
|
1524
|
+
sig { returns(T.self_type) }
|
1525
|
+
def kilobytes; end
|
1526
|
+
|
1527
|
+
# Returns the number of bytes equivalent to the megabytes provided.
|
1528
|
+
#
|
1529
|
+
# ```ruby
|
1530
|
+
# 2.megabytes # => 2_097_152
|
1531
|
+
# ```
|
1532
|
+
sig { returns(T.self_type) }
|
1533
|
+
def megabyte; end
|
1534
|
+
|
1535
|
+
# Returns the number of bytes equivalent to the megabytes provided.
|
1536
|
+
#
|
1537
|
+
# ```ruby
|
1538
|
+
# 2.megabytes # => 2_097_152
|
1539
|
+
# ```
|
1540
|
+
sig { returns(T.self_type) }
|
1541
|
+
def megabytes; end
|
1542
|
+
|
1543
|
+
# Returns the number of bytes equivalent to the gigabytes provided.
|
1544
|
+
#
|
1545
|
+
# ```ruby
|
1546
|
+
# 2.gigabytes # => 2_147_483_648
|
1547
|
+
# ```
|
1548
|
+
sig { returns(T.self_type) }
|
1549
|
+
def gigabyte; end
|
1550
|
+
|
1551
|
+
# Returns the number of bytes equivalent to the gigabytes provided.
|
1552
|
+
#
|
1553
|
+
# ```ruby
|
1554
|
+
# 2.gigabytes # => 2_147_483_648
|
1555
|
+
# ```
|
1556
|
+
sig { returns(T.self_type) }
|
1557
|
+
def gigabytes; end
|
1558
|
+
|
1559
|
+
# Returns the number of bytes equivalent to the terabytes provided.
|
1560
|
+
#
|
1561
|
+
# ```ruby
|
1562
|
+
# 2.terabytes # => 2_199_023_255_552
|
1563
|
+
# ```
|
1564
|
+
sig { returns(T.self_type) }
|
1565
|
+
def terabyte; end
|
1566
|
+
|
1567
|
+
# Returns the number of bytes equivalent to the terabytes provided.
|
1568
|
+
#
|
1569
|
+
# ```ruby
|
1570
|
+
# 2.terabytes # => 2_199_023_255_552
|
1571
|
+
# ```
|
1572
|
+
sig { returns(T.self_type) }
|
1573
|
+
def terabytes; end
|
1574
|
+
|
1575
|
+
# Returns the number of bytes equivalent to the petabytes provided.
|
1576
|
+
#
|
1577
|
+
# ```ruby
|
1578
|
+
# 2.petabytes # => 2_251_799_813_685_248
|
1579
|
+
# ```
|
1580
|
+
sig { returns(T.self_type) }
|
1581
|
+
def petabyte; end
|
1582
|
+
|
1583
|
+
# Returns the number of bytes equivalent to the petabytes provided.
|
1584
|
+
#
|
1585
|
+
# ```ruby
|
1586
|
+
# 2.petabytes # => 2_251_799_813_685_248
|
1587
|
+
# ```
|
1588
|
+
sig { returns(T.self_type) }
|
1589
|
+
def petabytes; end
|
1590
|
+
|
1591
|
+
# Returns the number of bytes equivalent to the exabytes provided.
|
1592
|
+
#
|
1593
|
+
# ```ruby
|
1594
|
+
# 2.exabytes # => 2_305_843_009_213_693_952
|
1595
|
+
# ```
|
1596
|
+
sig { returns(T.self_type) }
|
1597
|
+
def exabyte; end
|
1598
|
+
|
1599
|
+
# Returns the number of bytes equivalent to the exabytes provided.
|
1600
|
+
#
|
1601
|
+
# ```ruby
|
1602
|
+
# 2.exabytes # => 2_305_843_009_213_693_952
|
1603
|
+
# ```
|
1604
|
+
sig { returns(T.self_type) }
|
1605
|
+
def exabytes; end
|
1606
|
+
end
|
1607
|
+
|
1608
|
+
module Enumerable
|
1609
|
+
# https://github.com/rails/rails/blob/v5.2.3/activesupport/lib/active_support/core_ext/enumerable.rb#L64..L72
|
1610
|
+
# the case where a block isn't given isn't handled - that seems like an unlikely case
|
1611
|
+
sig do
|
1612
|
+
type_parameters(:key).params(
|
1613
|
+
block: T.proc.params(o: Enumerable::Elem).returns(T.type_parameter(:key))
|
1614
|
+
).returns(
|
1615
|
+
T::Hash[T.type_parameter(:key), Enumerable::Elem]
|
1616
|
+
)
|
1617
|
+
end
|
1618
|
+
def index_by(&block); end
|
1619
|
+
|
1620
|
+
sig { params(object: Object).returns(T::Boolean) }
|
1621
|
+
def exclude?(object); end
|
1622
|
+
|
1623
|
+
sig { returns(T::Boolean) }
|
1624
|
+
def many?(&block); end
|
1625
|
+
|
1626
|
+
def pluck(*keys); end
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
class ActiveSupport::Duration
|
1630
|
+
# Returns the number of seconds that this Duration represents.
|
1631
|
+
#
|
1632
|
+
# ```ruby
|
1633
|
+
# 1.minute.to_i # => 60
|
1634
|
+
# 1.hour.to_i # => 3600
|
1635
|
+
# 1.day.to_i # => 86400
|
1636
|
+
# ```
|
1637
|
+
#
|
1638
|
+
# Note that this conversion makes some assumptions about the
|
1639
|
+
# duration of some periods, e.g. months are always 1/12 of year
|
1640
|
+
# and years are 365.2425 days:
|
1641
|
+
#
|
1642
|
+
# ```ruby
|
1643
|
+
# # equivalent to (1.year / 12).to_i
|
1644
|
+
# 1.month.to_i # => 2629746
|
1645
|
+
#
|
1646
|
+
# # equivalent to 365.2425.days.to_i
|
1647
|
+
# 1.year.to_i # => 31556952
|
1648
|
+
# ```
|
1649
|
+
#
|
1650
|
+
# In such cases, Ruby's core
|
1651
|
+
# [Date](https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html) and
|
1652
|
+
# [Time](https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html) should be used for precision
|
1653
|
+
# date and time arithmetic.
|
1654
|
+
sig { returns(Integer) }
|
1655
|
+
def to_i; end
|
1656
|
+
|
1657
|
+
sig { returns(Float) }
|
1658
|
+
def to_f; end
|
1659
|
+
|
1660
|
+
# Returns the amount of seconds a duration covers as a string.
|
1661
|
+
# For more information check to_i method.
|
1662
|
+
#
|
1663
|
+
# ```ruby
|
1664
|
+
# 1.day.to_s # => "86400"
|
1665
|
+
# ```
|
1666
|
+
sig { returns(String) }
|
1667
|
+
def to_s; end
|
1668
|
+
|
1669
|
+
# Creates a new Duration from string formatted according to ISO 8601 Duration.
|
1670
|
+
#
|
1671
|
+
# See [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) for more information.
|
1672
|
+
# This method allows negative parts to be present in pattern.
|
1673
|
+
# If invalid string is provided, it will raise `ActiveSupport::Duration::ISO8601Parser::ParsingError`.
|
1674
|
+
sig { params(iso8601duration: String).returns(ActiveSupport::Duration) }
|
1675
|
+
def self.parse(iso8601duration); end
|
1676
|
+
|
1677
|
+
# Creates a new Duration from a seconds value that is converted
|
1678
|
+
# to the individual parts:
|
1679
|
+
#
|
1680
|
+
# ```ruby
|
1681
|
+
# ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
|
1682
|
+
# ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
|
1683
|
+
# ```
|
1684
|
+
sig { params(value: Numeric).returns(ActiveSupport::Duration) }
|
1685
|
+
def self.build(value); end
|
1686
|
+
|
1687
|
+
# Returns `true` if `other` is also a Duration instance, which has the
|
1688
|
+
# same parts as this one.
|
1689
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
1690
|
+
def eql?(other); end
|
1691
|
+
|
1692
|
+
# Compares one Duration with another or a Numeric to this Duration.
|
1693
|
+
# Numeric values are treated as seconds.
|
1694
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(Integer) }
|
1695
|
+
def <=>(other); end
|
1696
|
+
|
1697
|
+
# Adds another Duration or a Numeric to this Duration. Numeric values
|
1698
|
+
# are treated as seconds.
|
1699
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
1700
|
+
def +(other); end
|
1701
|
+
|
1702
|
+
# Subtracts another Duration or a Numeric from this Duration. Numeric
|
1703
|
+
# values are treated as seconds.
|
1704
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
1705
|
+
def -(other); end
|
1706
|
+
|
1707
|
+
# Multiplies this Duration by a Numeric and returns a new Duration.
|
1708
|
+
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
1709
|
+
def *(other); end
|
1710
|
+
|
1711
|
+
# Divides this Duration by a Numeric and returns a new Duration.
|
1712
|
+
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
1713
|
+
def /(other); end
|
1714
|
+
|
1715
|
+
# Returns the modulo of this Duration by another Duration or Numeric.
|
1716
|
+
# Numeric values are treated as seconds.
|
1717
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
1718
|
+
def %(other); end
|
1719
|
+
|
1720
|
+
# Returns `true` if `other` is also a Duration instance with the
|
1721
|
+
# same `value`, or if `other == value`.
|
1722
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
1723
|
+
def ==(other); end
|
1724
|
+
|
1725
|
+
# Build ISO 8601 Duration string for this duration.
|
1726
|
+
# The `precision` parameter can be used to limit seconds' precision of duration.
|
1727
|
+
sig { params(precision: T.nilable(Integer)).returns(String) }
|
1728
|
+
def iso8601(precision: nil); end
|
1729
|
+
|
1730
|
+
sig { params(time: T.any(ActiveSupport::TimeWithZone, Date)).returns(ActiveSupport::TimeWithZone) }
|
1731
|
+
def from_now(time = Time.current); end
|
1732
|
+
|
1733
|
+
sig { params(time: T.any(ActiveSupport::TimeWithZone, Date)).returns(ActiveSupport::TimeWithZone) }
|
1734
|
+
def ago(time = Time.current); end
|
1735
|
+
|
1736
|
+
sig { returns(Numeric) }
|
1737
|
+
def value; end
|
1738
|
+
end
|
1739
|
+
|
1740
|
+
module Benchmark
|
1741
|
+
sig { params(block: T.proc.void).returns(Float) }
|
1742
|
+
def self.ms(&block); end
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
ActiveSupport::Cache::FileStore::DIR_FORMATTER = T.let(T.unsafe(nil), String)
|
1746
|
+
|
1747
|
+
ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE = T.let(T.unsafe(nil), Integer)
|
1748
|
+
|
1749
|
+
ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer)
|
1750
|
+
|
1751
|
+
ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), T::Array[T.untyped])
|
1752
|
+
|
1753
|
+
ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer)
|
1754
|
+
|
1755
|
+
module ActiveSupport::Callbacks
|
1756
|
+
mixes_in_class_methods(::ActiveSupport::Callbacks::ClassMethods)
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
module ActiveSupport::Callbacks::ClassMethods; end
|
1760
|
+
|
1761
|
+
module ActiveSupport::Concern; end
|
1762
|
+
|
1763
|
+
module ActiveSupport::Configurable
|
1764
|
+
mixes_in_class_methods(::ActiveSupport::Configurable::ClassMethods)
|
1765
|
+
end
|
1766
|
+
|
1767
|
+
module ActiveSupport::Configurable::ClassMethods; end
|
1768
|
+
|
1769
|
+
class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions
|
1770
|
+
K = type_member(fixed: T.untyped)
|
1771
|
+
V = type_member(fixed: T.untyped)
|
1772
|
+
Elem = type_member(fixed: T.untyped)
|
1773
|
+
end
|
1774
|
+
|
1775
|
+
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
|
1776
|
+
|
1777
|
+
module ActiveSupport::Deprecation::InstanceDelegator
|
1778
|
+
mixes_in_class_methods(::ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators)
|
1779
|
+
end
|
1780
|
+
|
1781
|
+
module ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators; end
|
1782
|
+
|
1783
|
+
ActiveSupport::Deprecation::Reporting::RAILS_GEM_ROOT = T.let(T.unsafe(nil), String)
|
1784
|
+
|
1785
|
+
class ActiveSupport::DeprecationException < ::StandardError
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
class ActiveSupport::HashWithIndifferentAccess < Hash
|
1789
|
+
K = type_member(fixed: T.any(String, Symbol))
|
1790
|
+
V = type_member(fixed: T.untyped)
|
1791
|
+
Elem = type_member(fixed: T.untyped)
|
1792
|
+
end
|
1793
|
+
|
1794
|
+
ActiveSupport::JSON::DATETIME_REGEX = T.let(T.unsafe(nil), Regexp)
|
1795
|
+
|
1796
|
+
ActiveSupport::JSON::DATE_REGEX = T.let(T.unsafe(nil), Regexp)
|
1797
|
+
|
1798
|
+
ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String)
|
1799
|
+
|
1800
|
+
ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String)
|
1801
|
+
|
1802
|
+
ActiveSupport::LogSubscriber::BOLD = T.let(T.unsafe(nil), String)
|
1803
|
+
|
1804
|
+
ActiveSupport::LogSubscriber::CLEAR = T.let(T.unsafe(nil), String)
|
1805
|
+
|
1806
|
+
ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String)
|
1807
|
+
|
1808
|
+
ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String)
|
1809
|
+
|
1810
|
+
ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String)
|
1811
|
+
|
1812
|
+
ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String)
|
1813
|
+
|
1814
|
+
ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String)
|
1815
|
+
|
1816
|
+
ActiveSupport::LogSubscriber::YELLOW = T.let(T.unsafe(nil), String)
|
1817
|
+
|
1818
|
+
ActiveSupport::Multibyte::Unicode::NORMALIZATION_FORMS = T.let(T.unsafe(nil), T::Array[T.untyped])
|
1819
|
+
|
1820
|
+
ActiveSupport::Multibyte::Unicode::NORMALIZATION_FORM_ALIASES = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
|
1821
|
+
|
1822
|
+
ActiveSupport::Multibyte::Unicode::UNICODE_VERSION = T.let(T.unsafe(nil), String)
|
1823
|
+
|
1824
|
+
class ActiveSupport::OrderedHash < ::Hash
|
1825
|
+
K = type_member(fixed: T.untyped)
|
1826
|
+
V = type_member(fixed: T.untyped)
|
1827
|
+
Elem = type_member(fixed: T.untyped)
|
1828
|
+
end
|
1829
|
+
|
1830
|
+
class ActiveSupport::OrderedOptions < ::Hash
|
1831
|
+
K = type_member(fixed: T.untyped)
|
1832
|
+
V = type_member(fixed: T.untyped)
|
1833
|
+
Elem = type_member(fixed: T.untyped)
|
1834
|
+
end
|
1835
|
+
|
1836
|
+
ActiveSupport::ParameterFilter::FILTERED = T.let(T.unsafe(nil), String)
|
1837
|
+
|
1838
|
+
module ActiveSupport::Rescuable
|
1839
|
+
mixes_in_class_methods(::ActiveSupport::Rescuable::ClassMethods)
|
1840
|
+
end
|
1841
|
+
|
1842
|
+
module ActiveSupport::Rescuable::ClassMethods
|
1843
|
+
# https://github.com/rails/rails/blob/5-2-stable/activesupport/lib/active_support/rescuable.rb#L51
|
1844
|
+
sig { params(klasses: Class, with: T.nilable(Symbol), block: T.nilable(T.proc.params(error: T.untyped).void)).void }
|
1845
|
+
def rescue_from(*klasses, with: T.unsafe(nil), &block); end
|
1846
|
+
end
|
1847
|
+
|
1848
|
+
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), T::Array[T.untyped])
|
1849
|
+
|
1850
|
+
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), T::Array[T.untyped])
|