clean-architecture 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +21 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +42 -0
- data/Gemfile +1 -0
- data/README.md +423 -4
- data/clean-architecture.gemspec +9 -5
- data/generate_require_files.rb +1 -0
- data/lib/clean-architecture.rb +1 -0
- data/lib/clean_architecture/adapters/all.rb +1 -0
- data/lib/clean_architecture/adapters/attribute_hash_base.rb +1 -0
- data/lib/clean_architecture/all.rb +3 -0
- data/lib/clean_architecture/builders/abstract_active_record_entity_builder.rb +124 -0
- data/lib/clean_architecture/builders/all.rb +6 -0
- data/lib/clean_architecture/checks/all.rb +1 -0
- data/lib/clean_architecture/checks/authorization.rb +1 -0
- data/lib/clean_architecture/entities/all.rb +1 -0
- data/lib/clean_architecture/entities/failure_details.rb +2 -1
- data/lib/clean_architecture/entities/targeted_parameters.rb +1 -0
- data/lib/clean_architecture/entities/untargeted_parameters.rb +1 -0
- data/lib/clean_architecture/interfaces/all.rb +1 -0
- data/lib/clean_architecture/interfaces/authorization_parameters.rb +1 -0
- data/lib/clean_architecture/interfaces/base_parameters.rb +1 -0
- data/lib/clean_architecture/interfaces/jsonable.rb +1 -0
- data/lib/clean_architecture/interfaces/success_payload.rb +1 -0
- data/lib/clean_architecture/interfaces/targeted_parameters.rb +1 -0
- data/lib/clean_architecture/interfaces/use_case.rb +1 -0
- data/lib/clean_architecture/interfaces/use_case_actor.rb +1 -0
- data/lib/clean_architecture/interfaces/use_case_target.rb +1 -0
- data/lib/clean_architecture/matchers/all.rb +1 -0
- data/lib/clean_architecture/matchers/use_case_result.rb +1 -0
- data/lib/clean_architecture/queries/all.rb +1 -0
- data/lib/clean_architecture/queries/http_failure_code.rb +1 -0
- data/lib/clean_architecture/queries/http_success_code.rb +1 -0
- data/lib/clean_architecture/serializers/all.rb +1 -0
- data/lib/clean_architecture/serializers/html_response_from_result.rb +1 -0
- data/lib/clean_architecture/serializers/json_response_from_result.rb +1 -0
- data/lib/clean_architecture/serializers/success_collection_payload.rb +1 -0
- data/lib/clean_architecture/serializers/success_payload.rb +1 -0
- data/lib/clean_architecture/types.rb +2 -1
- data/lib/clean_architecture/use_cases/abstract_use_case.rb +62 -0
- data/lib/clean_architecture/use_cases/all.rb +10 -0
- data/lib/clean_architecture/use_cases/contract.rb +9 -0
- data/lib/clean_architecture/use_cases/errors.rb +57 -0
- data/lib/clean_architecture/use_cases/form.rb +116 -0
- data/lib/clean_architecture/use_cases/parameters.rb +42 -0
- data/lib/clean_architecture/version.rb +2 -1
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/activemodel.rbi +74 -0
- data/sorbet/rbi/gems/activesupport.rbi +440 -0
- data/sorbet/rbi/gems/ast.rbi +47 -0
- data/sorbet/rbi/gems/axiom-types.rbi +159 -0
- data/sorbet/rbi/gems/byebug.rbi +1039 -0
- data/sorbet/rbi/gems/codeclimate-engine-rb.rbi +123 -0
- data/sorbet/rbi/gems/coderay.rbi +91 -0
- data/sorbet/rbi/gems/coercible.rbi +156 -0
- data/sorbet/rbi/gems/concurrent-ruby.rbi +1587 -0
- data/sorbet/rbi/gems/descendants_tracker.rbi +17 -0
- data/sorbet/rbi/gems/docile.rbi +31 -0
- data/sorbet/rbi/gems/dry-configurable.rbi +89 -0
- data/sorbet/rbi/gems/dry-container.rbi +88 -0
- data/sorbet/rbi/gems/dry-core.rbi +79 -0
- data/sorbet/rbi/gems/dry-equalizer.rbi +25 -0
- data/sorbet/rbi/gems/dry-inflector.rbi +72 -0
- data/sorbet/rbi/gems/dry-initializer.rbi +209 -0
- data/sorbet/rbi/gems/dry-logic.rbi +304 -0
- data/sorbet/rbi/gems/dry-matcher.rbi +33 -0
- data/sorbet/rbi/gems/dry-monads.rbi +508 -0
- data/sorbet/rbi/gems/dry-schema.rbi +790 -0
- data/sorbet/rbi/gems/dry-struct.rbi +165 -0
- data/sorbet/rbi/gems/dry-types.rbi +688 -0
- data/sorbet/rbi/gems/dry-validation.rbi +284 -0
- data/sorbet/rbi/gems/duckface-interfaces.rbi +93 -0
- data/sorbet/rbi/gems/equalizer.rbi +22 -0
- data/sorbet/rbi/gems/i18n.rbi +132 -0
- data/sorbet/rbi/gems/ice_nine.rbi +66 -0
- data/sorbet/rbi/gems/jaro_winkler.rbi +14 -0
- data/sorbet/rbi/gems/kwalify.rbi +339 -0
- data/sorbet/rbi/gems/method_source.rbi +63 -0
- data/sorbet/rbi/gems/parallel.rbi +81 -0
- data/sorbet/rbi/gems/parser.rbi +1293 -0
- data/sorbet/rbi/gems/pry-byebug.rbi +149 -0
- data/sorbet/rbi/gems/pry.rbi +1964 -0
- data/sorbet/rbi/gems/psych.rbi +462 -0
- data/sorbet/rbi/gems/rainbow.rbi +117 -0
- data/sorbet/rbi/gems/rake.rbi +634 -0
- data/sorbet/rbi/gems/rb-readline.rbi +766 -0
- data/sorbet/rbi/gems/reek.rbi +1066 -0
- data/sorbet/rbi/gems/rspec-core.rbi +1658 -0
- data/sorbet/rbi/gems/rspec-expectations.rbi +430 -0
- data/sorbet/rbi/gems/rspec-mocks.rbi +815 -0
- data/sorbet/rbi/gems/rspec-support.rbi +268 -0
- data/sorbet/rbi/gems/rspec.rbi +14 -0
- data/sorbet/rbi/gems/rubocop-rspec.rbi +875 -0
- data/sorbet/rbi/gems/rubocop.rbi +7014 -0
- data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
- data/sorbet/rbi/gems/simplecov-html.rbi +30 -0
- data/sorbet/rbi/gems/simplecov.rbi +225 -0
- data/sorbet/rbi/gems/stackprof.rbi +51 -0
- data/sorbet/rbi/gems/thread_safe.rbi +81 -0
- data/sorbet/rbi/gems/timecop.rbi +97 -0
- data/sorbet/rbi/gems/unicode-display_width.rbi +16 -0
- data/sorbet/rbi/gems/virtus.rbi +421 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +7332 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +17521 -0
- data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +422 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6.0.0.rc1/activesupport.rbi +23 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +625 -0
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +8684 -0
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +99 -0
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +254 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +4222 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +111 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +543 -0
- data/sorbet/rbi/todo.rbi +12 -0
- metadata +156 -24
- data/Gemfile.lock +0 -187
@@ -0,0 +1,422 @@
|
|
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/activemodel/all/activemodel.rbi
|
7
|
+
#
|
8
|
+
# typed: strong
|
9
|
+
|
10
|
+
module ActiveModel::Dirty
|
11
|
+
extend T::Sig
|
12
|
+
sig { params(attr: Symbol, from: T.untyped, to: T.untyped).returns(T::Boolean) }
|
13
|
+
def attribute_changed?(attr, from: nil, to: nil); end
|
14
|
+
|
15
|
+
sig { params(attr_name: Symbol).returns(T::Boolean) }
|
16
|
+
def attribute_changed_in_place?(attr_name); end
|
17
|
+
|
18
|
+
sig { params(attr_name: Symbol).returns(T::Boolean) }
|
19
|
+
def attribute_previously_changed?(attr_name); end
|
20
|
+
|
21
|
+
sig { returns(T::Boolean) }
|
22
|
+
def changed?; end
|
23
|
+
end
|
24
|
+
|
25
|
+
module ActiveModel::Validations
|
26
|
+
module ClassMethods
|
27
|
+
# https://github.com/rails/rails/blob/v5.2.3/activemodel/lib/active_model/validations.rb#L136-L154
|
28
|
+
sig do
|
29
|
+
params(
|
30
|
+
names: T.any(Symbol, String),
|
31
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
32
|
+
on: T.any(Symbol, String),
|
33
|
+
prepend: T::Boolean,
|
34
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
35
|
+
).void
|
36
|
+
end
|
37
|
+
def validate(
|
38
|
+
*names,
|
39
|
+
if: nil,
|
40
|
+
on: nil,
|
41
|
+
prepend: false,
|
42
|
+
unless: nil
|
43
|
+
); end
|
44
|
+
|
45
|
+
# https://github.com/rails/rails/blob/v5.2.3/activemodel/lib/active_model/validations/validates.rb#L75-L105
|
46
|
+
sig do
|
47
|
+
params(
|
48
|
+
names: T.any(Symbol, String), # a splat of at least one attribute name
|
49
|
+
absence: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
50
|
+
acceptance: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
51
|
+
allow_blank: T::Boolean,
|
52
|
+
allow_nil: T::Boolean,
|
53
|
+
confirmation: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
54
|
+
# `exclusion` and `inclusion` are tricky to type without better support
|
55
|
+
# for overloading and shapes. Value can be anything that responds to
|
56
|
+
# `include?` (e.g. (1..3)), or a hash having an `in` or `within` key,
|
57
|
+
# like { in: [1, 2, 3], ... }
|
58
|
+
exclusion: T::Enumerable[T.untyped],
|
59
|
+
# `format` hash must additionally contain either :with or :without keys.
|
60
|
+
# Alternatively, it can be a Regexp.
|
61
|
+
format: T.any(T::Hash[T.untyped, T.untyped], Regexp),
|
62
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
63
|
+
# `exclusion` and `inclusion` are tricky to type without better support
|
64
|
+
# for overloading and shapes. Value can be anything that responds to
|
65
|
+
# `include?` (e.g. (1..3)), or a hash having an `in` or `within` key,
|
66
|
+
# like { in: [1, 2, 3], ... }
|
67
|
+
inclusion: T::Enumerable[T.untyped],
|
68
|
+
# if Hash, must contain :in, :within, :maximum, :minimum, or :is keys
|
69
|
+
length: T.any(T::Range[T.untyped], T::Hash[T.untyped, T.untyped]),
|
70
|
+
numericality: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
71
|
+
on: T.any(Symbol, String, T::Array[T.any(Symbol, String)]),
|
72
|
+
presence: T::Boolean,
|
73
|
+
size: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
74
|
+
strict: T::Boolean,
|
75
|
+
uniqueness: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
|
76
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
77
|
+
).void
|
78
|
+
end
|
79
|
+
def validates(
|
80
|
+
*names,
|
81
|
+
absence: false,
|
82
|
+
acceptance: {},
|
83
|
+
allow_blank: false,
|
84
|
+
allow_nil: false,
|
85
|
+
confirmation: false,
|
86
|
+
exclusion: [],
|
87
|
+
format: {},
|
88
|
+
if: nil,
|
89
|
+
inclusion: [],
|
90
|
+
length: {},
|
91
|
+
numericality: false,
|
92
|
+
on: :_,
|
93
|
+
presence: false,
|
94
|
+
size: false,
|
95
|
+
strict: false,
|
96
|
+
uniqueness: false,
|
97
|
+
unless: :_
|
98
|
+
)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class ActiveModel::Type::Boolean
|
104
|
+
sig { params(arg0: T.untyped).returns(T.nilable(T::Boolean))}
|
105
|
+
def cast(arg0); end
|
106
|
+
end
|
107
|
+
|
108
|
+
module ActiveModel::Validations::HelperMethods
|
109
|
+
sig do
|
110
|
+
params(
|
111
|
+
attr_names: T.any(String, Symbol),
|
112
|
+
message: String,
|
113
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
114
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
115
|
+
on: T.any(Symbol, String),
|
116
|
+
allow_nil: T::Boolean,
|
117
|
+
allow_blank: T::Boolean,
|
118
|
+
strict: T::Boolean
|
119
|
+
).void
|
120
|
+
end
|
121
|
+
def validates_absence_of(
|
122
|
+
*attr_names,
|
123
|
+
message: 'must be blank',
|
124
|
+
if: nil,
|
125
|
+
unless: :_,
|
126
|
+
on: :_,
|
127
|
+
allow_nil: false,
|
128
|
+
allow_blank: false,
|
129
|
+
strict: false
|
130
|
+
); end
|
131
|
+
|
132
|
+
sig do
|
133
|
+
params(
|
134
|
+
attr_names: T.any(String, Symbol),
|
135
|
+
message: String,
|
136
|
+
accept: T.untyped,
|
137
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
138
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
139
|
+
on: T.any(Symbol, String),
|
140
|
+
allow_nil: T::Boolean,
|
141
|
+
allow_blank: T::Boolean,
|
142
|
+
strict: T::Boolean
|
143
|
+
).void
|
144
|
+
end
|
145
|
+
def validates_acceptance_of(
|
146
|
+
*attr_names,
|
147
|
+
message: 'must be accepted',
|
148
|
+
accept: ['1', true],
|
149
|
+
if: nil,
|
150
|
+
unless: :_,
|
151
|
+
on: :_,
|
152
|
+
allow_nil: false,
|
153
|
+
allow_blank: false,
|
154
|
+
strict: false
|
155
|
+
); end
|
156
|
+
|
157
|
+
sig do
|
158
|
+
params(
|
159
|
+
attr_names: T.any(String, Symbol),
|
160
|
+
message: String,
|
161
|
+
case_sensitive: T::Boolean,
|
162
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
163
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
164
|
+
on: T.any(Symbol, String),
|
165
|
+
allow_nil: T::Boolean,
|
166
|
+
allow_blank: T::Boolean,
|
167
|
+
strict: T::Boolean
|
168
|
+
).void
|
169
|
+
end
|
170
|
+
def validates_confirmation_of(
|
171
|
+
*attr_names,
|
172
|
+
message: "doesn't match %{translated_attribute_name}",
|
173
|
+
case_sensitive: true,
|
174
|
+
if: nil,
|
175
|
+
unless: :_,
|
176
|
+
on: :_,
|
177
|
+
allow_nil: false,
|
178
|
+
allow_blank: false,
|
179
|
+
strict: false
|
180
|
+
); end
|
181
|
+
|
182
|
+
# A type alias for the in/within parameters on the
|
183
|
+
# validates_(inclusion/exclusion)_of methods.
|
184
|
+
InWithinType = T.type_alias do
|
185
|
+
T.nilable(
|
186
|
+
T.any(
|
187
|
+
Symbol,
|
188
|
+
String,
|
189
|
+
T::Array[T.any(String, Symbol)],
|
190
|
+
T::Range[Integer],
|
191
|
+
T.proc.params(arg0: T.untyped).returns(T::Boolean)
|
192
|
+
)
|
193
|
+
)
|
194
|
+
end
|
195
|
+
sig do
|
196
|
+
params(
|
197
|
+
attr_names: T.any(String, Symbol),
|
198
|
+
message: String,
|
199
|
+
in: InWithinType,
|
200
|
+
within: InWithinType,
|
201
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
202
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
203
|
+
on: T.any(Symbol, String),
|
204
|
+
allow_nil: T::Boolean,
|
205
|
+
allow_blank: T::Boolean,
|
206
|
+
strict: T::Boolean
|
207
|
+
).void
|
208
|
+
end
|
209
|
+
def validates_exclusion_of(
|
210
|
+
*attr_names,
|
211
|
+
message: 'is reserved',
|
212
|
+
in: nil,
|
213
|
+
within: nil,
|
214
|
+
if: nil,
|
215
|
+
unless: :_,
|
216
|
+
on: :_,
|
217
|
+
allow_nil: false,
|
218
|
+
allow_blank: false,
|
219
|
+
strict: false
|
220
|
+
); end
|
221
|
+
|
222
|
+
sig do
|
223
|
+
params(
|
224
|
+
attr_names: T.any(String, Symbol),
|
225
|
+
message: String,
|
226
|
+
with: T.untyped,
|
227
|
+
without: T.untyped,
|
228
|
+
multiline: T.untyped,
|
229
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
230
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
231
|
+
on: T.any(Symbol, String),
|
232
|
+
allow_nil: T::Boolean,
|
233
|
+
allow_blank: T::Boolean,
|
234
|
+
strict: T::Boolean
|
235
|
+
).void
|
236
|
+
end
|
237
|
+
def validates_format_of(
|
238
|
+
*attr_names,
|
239
|
+
message: 'is invalid',
|
240
|
+
with: nil,
|
241
|
+
without: nil,
|
242
|
+
multiline: nil,
|
243
|
+
if: nil,
|
244
|
+
unless: :_,
|
245
|
+
on: :_,
|
246
|
+
allow_nil: false,
|
247
|
+
allow_blank: false,
|
248
|
+
strict: false
|
249
|
+
); end
|
250
|
+
|
251
|
+
sig do
|
252
|
+
params(
|
253
|
+
attr_names: T.any(String, Symbol),
|
254
|
+
message: String,
|
255
|
+
in: InWithinType,
|
256
|
+
within: InWithinType,
|
257
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
258
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
259
|
+
on: T.any(Symbol, String),
|
260
|
+
allow_nil: T::Boolean,
|
261
|
+
allow_blank: T::Boolean,
|
262
|
+
strict: T::Boolean
|
263
|
+
).void
|
264
|
+
end
|
265
|
+
def validates_inclusion_of(
|
266
|
+
*attr_names,
|
267
|
+
message: 'is not included in the list',
|
268
|
+
in: nil,
|
269
|
+
within: nil,
|
270
|
+
if: nil,
|
271
|
+
unless: :_,
|
272
|
+
on: :_,
|
273
|
+
allow_nil: false,
|
274
|
+
allow_blank: false,
|
275
|
+
strict: false
|
276
|
+
); end
|
277
|
+
|
278
|
+
sig do
|
279
|
+
params(
|
280
|
+
attr_names: T.any(String, Symbol),
|
281
|
+
message: T.nilable(String),
|
282
|
+
minimum: T.nilable(Integer),
|
283
|
+
maximum: T.nilable(Integer),
|
284
|
+
is: T.nilable(Integer),
|
285
|
+
within: T.nilable(T::Range[Integer]),
|
286
|
+
in: T.nilable(T::Range[Integer]),
|
287
|
+
too_long: String,
|
288
|
+
too_short: String,
|
289
|
+
wrong_length: String,
|
290
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
291
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
292
|
+
on: T.any(Symbol, String),
|
293
|
+
allow_nil: T::Boolean,
|
294
|
+
allow_blank: T::Boolean,
|
295
|
+
strict: T::Boolean
|
296
|
+
).void
|
297
|
+
end
|
298
|
+
def validates_length_of(
|
299
|
+
*attr_names,
|
300
|
+
message: nil,
|
301
|
+
minimum: nil,
|
302
|
+
maximum: nil,
|
303
|
+
is: nil,
|
304
|
+
within: nil,
|
305
|
+
in: nil,
|
306
|
+
too_long: 'is too long (maximum is %{count} characters)',
|
307
|
+
too_short: 'is too short (minimum is %{count} characters)',
|
308
|
+
wrong_length: 'is the wrong length (should be %{count} characters)',
|
309
|
+
if: nil,
|
310
|
+
unless: :_,
|
311
|
+
on: :_,
|
312
|
+
allow_nil: false,
|
313
|
+
allow_blank: false,
|
314
|
+
strict: false
|
315
|
+
); end
|
316
|
+
|
317
|
+
# validates_size_of is an alias of validates_length_of
|
318
|
+
sig do
|
319
|
+
params(
|
320
|
+
attr_names: T.any(String, Symbol),
|
321
|
+
message: T.nilable(String),
|
322
|
+
minimum: T.nilable(Integer),
|
323
|
+
maximum: T.nilable(Integer),
|
324
|
+
is: T.nilable(Integer),
|
325
|
+
within: T.nilable(T::Range[Integer]),
|
326
|
+
in: T.nilable(T::Range[Integer]),
|
327
|
+
too_long: String,
|
328
|
+
too_short: String,
|
329
|
+
wrong_length: String,
|
330
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
331
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
332
|
+
on: T.any(Symbol, String),
|
333
|
+
allow_nil: T::Boolean,
|
334
|
+
allow_blank: T::Boolean,
|
335
|
+
strict: T::Boolean
|
336
|
+
).void
|
337
|
+
end
|
338
|
+
def validates_size_of(
|
339
|
+
*attr_names,
|
340
|
+
message: nil,
|
341
|
+
minimum: nil,
|
342
|
+
maximum: nil,
|
343
|
+
is: nil,
|
344
|
+
within: nil,
|
345
|
+
in: nil,
|
346
|
+
too_long: 'is too long (maximum is %{count} characters)',
|
347
|
+
too_short: 'is too short (minimum is %{count} characters)',
|
348
|
+
wrong_length: 'is the wrong length (should be %{count} characters)',
|
349
|
+
if: nil,
|
350
|
+
unless: :_,
|
351
|
+
on: :_,
|
352
|
+
allow_nil: false,
|
353
|
+
allow_blank: false,
|
354
|
+
strict: false
|
355
|
+
); end
|
356
|
+
|
357
|
+
# Create a type alias so we don't have to repeat this long type signature 6 times.
|
358
|
+
NumberComparatorType = T.type_alias {T.nilable(T.any(Integer, Float, T.proc.params(arg0: T.untyped).returns(T::Boolean), Symbol))}
|
359
|
+
sig do
|
360
|
+
params(
|
361
|
+
attr_names: T.any(String, Symbol),
|
362
|
+
message: String,
|
363
|
+
only_integer: T::Boolean,
|
364
|
+
greater_than: NumberComparatorType,
|
365
|
+
greater_than_or_equal_to: NumberComparatorType,
|
366
|
+
equal_to: NumberComparatorType,
|
367
|
+
less_than: NumberComparatorType,
|
368
|
+
less_than_or_equal_to: NumberComparatorType,
|
369
|
+
other_than: NumberComparatorType,
|
370
|
+
odd: T::Boolean,
|
371
|
+
even: T::Boolean,
|
372
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
373
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
374
|
+
on: T.any(Symbol, String),
|
375
|
+
allow_nil: T::Boolean,
|
376
|
+
allow_blank: T::Boolean,
|
377
|
+
strict: T::Boolean
|
378
|
+
).void
|
379
|
+
end
|
380
|
+
def validates_numericality_of(
|
381
|
+
*attr_names,
|
382
|
+
message: 'is not a number',
|
383
|
+
only_integer: false,
|
384
|
+
greater_than: nil,
|
385
|
+
greater_than_or_equal_to: nil,
|
386
|
+
equal_to: nil,
|
387
|
+
less_than: nil,
|
388
|
+
less_than_or_equal_to: nil,
|
389
|
+
other_than: nil,
|
390
|
+
odd: false,
|
391
|
+
even: false,
|
392
|
+
if: nil,
|
393
|
+
unless: :_,
|
394
|
+
on: :_,
|
395
|
+
allow_nil: false,
|
396
|
+
allow_blank: false,
|
397
|
+
strict: false
|
398
|
+
); end
|
399
|
+
|
400
|
+
sig do
|
401
|
+
params(
|
402
|
+
attr_names: T.any(String, Symbol),
|
403
|
+
message: String,
|
404
|
+
if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
405
|
+
unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
|
406
|
+
on: T.any(Symbol, String),
|
407
|
+
allow_nil: T::Boolean,
|
408
|
+
allow_blank: T::Boolean,
|
409
|
+
strict: T::Boolean
|
410
|
+
).void
|
411
|
+
end
|
412
|
+
def validates_presence_of(
|
413
|
+
*attr_names,
|
414
|
+
message: "can't be blank",
|
415
|
+
if: nil,
|
416
|
+
unless: :_,
|
417
|
+
on: :_,
|
418
|
+
allow_nil: false,
|
419
|
+
allow_blank: false,
|
420
|
+
strict: false
|
421
|
+
); end
|
422
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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/>=6.0.0.rc1/activesupport.rbi
|
7
|
+
#
|
8
|
+
# typed: strong
|
9
|
+
|
10
|
+
class Array
|
11
|
+
sig { params(elements: T.untyped).returns(T::Array[T.untyped]) }
|
12
|
+
def excluding(*elements); end
|
13
|
+
|
14
|
+
sig do
|
15
|
+
params(
|
16
|
+
blk: T.nilable(T.proc.params(arg0: Elem).returns(T::Boolean))
|
17
|
+
).returns(T.any(T::Array[Elem], T::Enumerable[Elem]))
|
18
|
+
end
|
19
|
+
def extract!(&blk); end
|
20
|
+
|
21
|
+
sig { params(elements: T.untyped).returns(T::Array[T.untyped]) }
|
22
|
+
def including(*elements); end
|
23
|
+
end
|
@@ -0,0 +1,625 @@
|
|
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.class_of(ActionController::Base)).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(String) }
|
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
|
+
sig { params(zone: String).returns(T.any(Time, ActiveSupport::TimeWithZone)) }
|
164
|
+
def in_time_zone(zone = ::Time.zone); end
|
165
|
+
|
166
|
+
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
167
|
+
def indent!(amount, indent_string = nil, indent_empty_lines = false); end
|
168
|
+
|
169
|
+
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
170
|
+
def indent(amount, indent_string = nil, indent_empty_lines = false); end
|
171
|
+
|
172
|
+
sig { returns(ActiveSupport::StringInquirer) }
|
173
|
+
def inquiry; end
|
174
|
+
|
175
|
+
sig { returns(T::Boolean) }
|
176
|
+
def is_utf8?; end
|
177
|
+
|
178
|
+
sig { params(limit: Integer).returns(String) }
|
179
|
+
def last(limit = 1); end
|
180
|
+
|
181
|
+
sig { returns(ActiveSupport::Multibyte::Chars) }
|
182
|
+
def mb_chars; end
|
183
|
+
|
184
|
+
sig { params(separator: String, preserve_case: T::Boolean).returns(String) }
|
185
|
+
def parameterize(separator: "-", preserve_case: false); end
|
186
|
+
|
187
|
+
sig { params(count: T.nilable(Integer), locale: Symbol).returns(String) }
|
188
|
+
def pluralize(count = nil, locale = :en); end
|
189
|
+
|
190
|
+
sig { params(patterns: T.untyped).returns(T.untyped) }
|
191
|
+
def remove!(*patterns); end
|
192
|
+
|
193
|
+
sig { params(patterns: T.untyped).returns(T.untyped) }
|
194
|
+
def remove(*patterns); end
|
195
|
+
|
196
|
+
sig { returns(T.untyped) }
|
197
|
+
def safe_constantize; end
|
198
|
+
|
199
|
+
sig { params(locale: Symbol).returns(T.nilable(String)) }
|
200
|
+
def singularize(locale = :en); end
|
201
|
+
|
202
|
+
sig { returns(T.untyped) }
|
203
|
+
def squish!; end
|
204
|
+
|
205
|
+
sig { returns(String) }
|
206
|
+
def squish; end
|
207
|
+
|
208
|
+
# starts_with? is an alias of the core method 'start_with?''
|
209
|
+
sig { params(arg0: String).returns(T::Boolean) }
|
210
|
+
def starts_with?(*arg0); end
|
211
|
+
|
212
|
+
sig { returns(String) }
|
213
|
+
def strip_heredoc; end
|
214
|
+
|
215
|
+
sig { returns(String) }
|
216
|
+
def tableize; end
|
217
|
+
|
218
|
+
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
219
|
+
def titleize(keep_id_suffix: false); end
|
220
|
+
|
221
|
+
# titlecase is an alias of titleize
|
222
|
+
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
223
|
+
def titlecase(keep_id_suffix: false); end
|
224
|
+
|
225
|
+
sig { params(position: Integer).returns(String) }
|
226
|
+
def to(position); end
|
227
|
+
|
228
|
+
sig { returns(Date) }
|
229
|
+
def to_date; end
|
230
|
+
|
231
|
+
sig { returns(DateTime) }
|
232
|
+
def to_datetime; end
|
233
|
+
|
234
|
+
sig { params(form: Symbol).returns(Time) }
|
235
|
+
def to_time(form = :local); end
|
236
|
+
|
237
|
+
sig { params(truncate_at: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
238
|
+
def truncate(truncate_at, separator: nil, omission: "..."); end
|
239
|
+
|
240
|
+
sig { params(words_count: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
241
|
+
def truncate_words(words_count, separator: nil, omission: "..."); end
|
242
|
+
|
243
|
+
sig { returns(String) }
|
244
|
+
def underscore; end
|
245
|
+
|
246
|
+
sig { returns(String) }
|
247
|
+
def upcase_first; end
|
248
|
+
end
|
249
|
+
|
250
|
+
class Array
|
251
|
+
sig { returns(T::Boolean) }
|
252
|
+
def blank?; end
|
253
|
+
|
254
|
+
sig { returns(T::Array[T.untyped]) }
|
255
|
+
def deep_dup; end
|
256
|
+
|
257
|
+
sig { returns(T::Hash[T.untyped, T.untyped]) }
|
258
|
+
def extract_options!; end
|
259
|
+
|
260
|
+
sig { returns(Elem) }
|
261
|
+
def fifth; end
|
262
|
+
|
263
|
+
sig { returns(Elem) }
|
264
|
+
def forty_two; end
|
265
|
+
|
266
|
+
sig { returns(Elem) }
|
267
|
+
def fourth; end
|
268
|
+
|
269
|
+
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
270
|
+
def from(position); end
|
271
|
+
|
272
|
+
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
273
|
+
def in_groups(number, fill_with = nil); end
|
274
|
+
|
275
|
+
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
276
|
+
def in_groups_of(number, fill_with = nil); end
|
277
|
+
|
278
|
+
sig { returns(T.untyped) }
|
279
|
+
def inquiry; end
|
280
|
+
|
281
|
+
sig { returns(Elem) }
|
282
|
+
def second; end
|
283
|
+
|
284
|
+
sig { returns(Elem) }
|
285
|
+
def second_to_last; end
|
286
|
+
|
287
|
+
sig do
|
288
|
+
params(
|
289
|
+
value: T.untyped,
|
290
|
+
blk: T.proc.params(arg0: Elem).void
|
291
|
+
).returns(T::Array[Elem])
|
292
|
+
end
|
293
|
+
def split(value = nil, &blk); end
|
294
|
+
|
295
|
+
sig { returns(Elem) }
|
296
|
+
def third; end
|
297
|
+
|
298
|
+
sig { returns(Elem) }
|
299
|
+
def third_to_last; end
|
300
|
+
|
301
|
+
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
302
|
+
def to(position); end
|
303
|
+
|
304
|
+
# to_default_s is an alias of the core method 'to_s'
|
305
|
+
sig {returns(String)}
|
306
|
+
def to_defaul_s; end
|
307
|
+
|
308
|
+
sig { params(format: Symbol).returns(String) }
|
309
|
+
def to_formatted_s(format = :default); end
|
310
|
+
|
311
|
+
sig { returns(String) }
|
312
|
+
def to_param; end
|
313
|
+
|
314
|
+
sig { params(key: String).returns(String) }
|
315
|
+
def to_query(key); end
|
316
|
+
|
317
|
+
sig do
|
318
|
+
params(
|
319
|
+
words_connector: String,
|
320
|
+
two_words_connector: String,
|
321
|
+
last_word_connector: String,
|
322
|
+
locale: T.nilable(Symbol)
|
323
|
+
).returns(String)
|
324
|
+
end
|
325
|
+
def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: ", and ", locale: nil); end
|
326
|
+
|
327
|
+
sig { params(options: T.untyped).returns(T.untyped) }
|
328
|
+
def to_xml(options = nil); end
|
329
|
+
|
330
|
+
sig { params(elements: T.untyped).returns(T.untyped) }
|
331
|
+
def without(*elements); end
|
332
|
+
end
|
333
|
+
|
334
|
+
module ActiveSupport::NumberHelper
|
335
|
+
sig do
|
336
|
+
params(
|
337
|
+
number: T.any(Integer, Float, String),
|
338
|
+
locale: Symbol,
|
339
|
+
precision: T.nilable(Integer),
|
340
|
+
unit: String,
|
341
|
+
separator: String,
|
342
|
+
delimiter: String,
|
343
|
+
format: String,
|
344
|
+
negative_format: String
|
345
|
+
).returns(String)
|
346
|
+
end
|
347
|
+
def number_to_currency(number, locale: :en, precision: 2, unit: "$", separator: ".", delimiter: ",", format: "%u%n", negative_format: "-%u%n"); end
|
348
|
+
|
349
|
+
sig do
|
350
|
+
params(
|
351
|
+
number: T.any(Integer, Float, String),
|
352
|
+
locale: Symbol,
|
353
|
+
delimiter: String,
|
354
|
+
separator: String,
|
355
|
+
delimiter_pattern: T.nilable(Regexp)
|
356
|
+
).returns(String)
|
357
|
+
end
|
358
|
+
def number_to_delimited(number, locale: :en, delimiter: ",", separator: ".", delimiter_pattern: nil); end
|
359
|
+
|
360
|
+
sig do
|
361
|
+
params(
|
362
|
+
number: T.any(Integer, Float, String),
|
363
|
+
locale: Symbol,
|
364
|
+
precision: T.nilable(Integer),
|
365
|
+
significant: T::Boolean,
|
366
|
+
separator: String,
|
367
|
+
delimiter: String,
|
368
|
+
strip_insignificant_zeros: T::Boolean,
|
369
|
+
units: T.any(T::Hash[T.untyped, T.untyped], String, Symbol),
|
370
|
+
format: String
|
371
|
+
).returns(String)
|
372
|
+
end
|
373
|
+
def number_to_human(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true, units: {}, format: "%n %u"); end
|
374
|
+
|
375
|
+
sig do
|
376
|
+
params(
|
377
|
+
number: T.any(Integer, Float, String),
|
378
|
+
locale: Symbol,
|
379
|
+
precision: T.nilable(Integer),
|
380
|
+
significant: T::Boolean,
|
381
|
+
separator: String,
|
382
|
+
delimiter: String,
|
383
|
+
strip_insignificant_zeros: T::Boolean
|
384
|
+
).returns(String)
|
385
|
+
end
|
386
|
+
def number_to_human_size(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true); end
|
387
|
+
|
388
|
+
sig do
|
389
|
+
params(
|
390
|
+
number: T.any(Integer, Float, String),
|
391
|
+
locale: Symbol,
|
392
|
+
precision: T.nilable(Integer),
|
393
|
+
significant: T::Boolean,
|
394
|
+
separator: String,
|
395
|
+
delimiter: String,
|
396
|
+
strip_insignificant_zeros: T::Boolean,
|
397
|
+
format: String
|
398
|
+
).returns(String)
|
399
|
+
end
|
400
|
+
def number_to_percentage(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false, format: "%n%"); end
|
401
|
+
|
402
|
+
sig do
|
403
|
+
params(
|
404
|
+
number: T.any(Integer, Float, String),
|
405
|
+
area_code: T::Boolean,
|
406
|
+
delimiter: String,
|
407
|
+
extension: T.nilable(Integer),
|
408
|
+
country_code: T.nilable(Integer),
|
409
|
+
pattern: T.nilable(Regexp)
|
410
|
+
).returns(String)
|
411
|
+
end
|
412
|
+
def number_to_phone(number, area_code: false, delimiter: "-", extension: nil, country_code: nil, pattern: nil); end
|
413
|
+
|
414
|
+
sig do
|
415
|
+
params(
|
416
|
+
number: T.any(Integer, Float, String),
|
417
|
+
locale: Symbol,
|
418
|
+
precision: T.nilable(Integer),
|
419
|
+
significant: T::Boolean,
|
420
|
+
separator: String,
|
421
|
+
delimiter: String,
|
422
|
+
strip_insignificant_zeros: T::Boolean
|
423
|
+
).returns(String)
|
424
|
+
end
|
425
|
+
def number_to_rounded(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false); end
|
426
|
+
end
|
427
|
+
|
428
|
+
module ActiveSupport::Inflector
|
429
|
+
sig do
|
430
|
+
params(
|
431
|
+
term: String,
|
432
|
+
uppercase_first_letter: T::Boolean
|
433
|
+
).returns(String)
|
434
|
+
end
|
435
|
+
def camelize(term, uppercase_first_letter = true); end
|
436
|
+
|
437
|
+
sig { params(table_name: String).returns(String) }
|
438
|
+
def classify(table_name); end
|
439
|
+
|
440
|
+
sig { params(camel_cased_word: String).returns(T.untyped) }
|
441
|
+
def constantize(camel_cased_word); end
|
442
|
+
|
443
|
+
sig { params(underscored_word: String).returns(String) }
|
444
|
+
def dasherize(underscored_word); end
|
445
|
+
|
446
|
+
sig { params(path: String).returns(String) }
|
447
|
+
def deconstantize(path); end
|
448
|
+
|
449
|
+
sig { params(path: String).returns(String) }
|
450
|
+
def demodulize(path); end
|
451
|
+
|
452
|
+
sig do
|
453
|
+
params(
|
454
|
+
class_name: String,
|
455
|
+
separate_class_name_and_id_with_underscore: T::Boolean
|
456
|
+
).returns(String)
|
457
|
+
end
|
458
|
+
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true); end
|
459
|
+
|
460
|
+
sig do
|
461
|
+
params(
|
462
|
+
lower_case_and_underscored_word: String,
|
463
|
+
capitalize: T::Boolean,
|
464
|
+
keep_id_suffix: T::Boolean
|
465
|
+
).returns(String)
|
466
|
+
end
|
467
|
+
def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false); end
|
468
|
+
|
469
|
+
sig { params(locale: Symbol, blk: T.untyped).returns(T.untyped) }
|
470
|
+
def inflections(locale = :en, &blk); end
|
471
|
+
|
472
|
+
sig { params(number: Integer).returns(String) }
|
473
|
+
def ordinal(number); end
|
474
|
+
|
475
|
+
sig { params(number: Integer).returns(String) }
|
476
|
+
def ordinalize(number); end
|
477
|
+
|
478
|
+
sig do
|
479
|
+
params(
|
480
|
+
string: String,
|
481
|
+
separator: String,
|
482
|
+
preserve_case: T::Boolean,
|
483
|
+
locale: Symbol
|
484
|
+
).returns(String)
|
485
|
+
end
|
486
|
+
def parameterize(string, separator: '-', preserve_case: false, locale: nil); end
|
487
|
+
|
488
|
+
sig { params(word: String, locale: Symbol).returns(String) }
|
489
|
+
def pluralize(word, locale = :en); end
|
490
|
+
|
491
|
+
sig { params(camel_cased_word: String).returns(T.untyped) }
|
492
|
+
def safe_constantize(camel_cased_word); end
|
493
|
+
|
494
|
+
sig { params(word: String, locale: Symbol).returns(String) }
|
495
|
+
def singularize(word, locale = :en); end
|
496
|
+
|
497
|
+
sig { params(class_name: String).returns(String) }
|
498
|
+
def tableize(class_name); end
|
499
|
+
|
500
|
+
sig { params(word: String, keep_id_suffix: T::Boolean).returns(String) }
|
501
|
+
def titleize(word, keep_id_suffix: false); end
|
502
|
+
|
503
|
+
sig { params(string: String, replacement: String, locale: Symbol).returns(String) }
|
504
|
+
def transliterate(string, replacement = '?', locale: nil); end
|
505
|
+
|
506
|
+
sig { params(camel_cased_word: String).returns(String) }
|
507
|
+
def underscore(camel_cased_word); end
|
508
|
+
|
509
|
+
sig { params(string: String).returns(String) }
|
510
|
+
def upcase_first(string); end
|
511
|
+
end
|
512
|
+
|
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
|
+
end
|
548
|
+
|
549
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time
|
550
|
+
# this is not a complete definition!
|
551
|
+
class Time
|
552
|
+
sig { returns(Time) }
|
553
|
+
def midnight; end
|
554
|
+
|
555
|
+
sig { returns(Time) }
|
556
|
+
def beginning_of_day; end
|
557
|
+
|
558
|
+
sig { returns(Time) }
|
559
|
+
def at_midnight; end
|
560
|
+
|
561
|
+
sig { returns(Time) }
|
562
|
+
def at_beginning_of_day; end
|
563
|
+
|
564
|
+
sig { returns(Time) }
|
565
|
+
def middle_of_day; end
|
566
|
+
|
567
|
+
sig { returns(Time) }
|
568
|
+
def midday; end
|
569
|
+
|
570
|
+
sig { returns(Time) }
|
571
|
+
def noon; end
|
572
|
+
|
573
|
+
sig { returns(Time) }
|
574
|
+
def at_midday; end
|
575
|
+
|
576
|
+
sig { returns(Time) }
|
577
|
+
def at_noon; end
|
578
|
+
|
579
|
+
sig { returns(Time) }
|
580
|
+
def at_middle_of_day; end
|
581
|
+
|
582
|
+
# https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
|
583
|
+
sig { params(zone: String).returns(T.any(Time, ActiveSupport::TimeWithZone)) }
|
584
|
+
def in_time_zone(zone = ::Time.zone); end
|
585
|
+
end
|
586
|
+
|
587
|
+
# defines some of the methods at https://github.com/rails/rails/tree/v6.0.0/activesupport/lib/active_support/core_ext/hash
|
588
|
+
# this is not a complete definition!
|
589
|
+
class Hash
|
590
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
591
|
+
def stringify_keys; end
|
592
|
+
|
593
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
594
|
+
def stringify_keys!; end
|
595
|
+
|
596
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
597
|
+
def deep_stringify_keys; end
|
598
|
+
|
599
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
600
|
+
def deep_stringify_keys!; end
|
601
|
+
|
602
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
603
|
+
def symbolize_keys; end
|
604
|
+
|
605
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
606
|
+
def symbolize_keys!; end
|
607
|
+
|
608
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
609
|
+
def deep_symbolize_keys; end
|
610
|
+
|
611
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
612
|
+
def deep_symbolize_keys!; end
|
613
|
+
|
614
|
+
# in an ideal world, `arg` would be the type of all keys, the 1st `T.untyped` would be
|
615
|
+
# the type of keys your block returns, and the 2nd `T.untyped` would be the type of values
|
616
|
+
# that the hash had.
|
617
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
618
|
+
def deep_transform_keys(&block); end
|
619
|
+
|
620
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
621
|
+
def deep_transform_keys!(&block); end
|
622
|
+
|
623
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
624
|
+
def to_options; end
|
625
|
+
end
|