clean-architecture 5.0.2 → 6.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/ci.yml +15 -19
- data/.gitignore +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/README.md +1 -585
- data/bin/tapioca +29 -0
- data/clean-architecture.gemspec +4 -4
- data/lib/clean-architecture.rb +4 -1
- data/lib/clean_architecture/adapters/all.rb +1 -1
- data/lib/clean_architecture/adapters/attribute_hash_base.rb +47 -20
- data/lib/clean_architecture/all.rb +1 -4
- data/lib/clean_architecture/builders/abstract_active_record_entity_builder.rb +43 -13
- data/lib/clean_architecture/builders/all.rb +1 -1
- data/lib/clean_architecture/checks/all.rb +1 -1
- data/lib/clean_architecture/checks/authorization.rb +11 -9
- data/lib/clean_architecture/entities/all.rb +1 -3
- data/lib/clean_architecture/entities/failure_details.rb +27 -17
- data/lib/clean_architecture/matchers/all.rb +1 -1
- data/lib/clean_architecture/matchers/use_case_result.rb +9 -3
- data/lib/clean_architecture/queries/all.rb +1 -1
- data/lib/clean_architecture/queries/http_failure_code.rb +8 -20
- data/lib/clean_architecture/queries/http_success_code.rb +14 -7
- data/lib/clean_architecture/serializers/all.rb +1 -1
- data/lib/clean_architecture/serializers/html_response_from_result.rb +7 -1
- data/lib/clean_architecture/serializers/json_response_from_result.rb +4 -4
- data/lib/clean_architecture/version.rb +1 -1
- data/nix/sources.json +14 -0
- data/nix/sources.nix +174 -0
- data/run_ci.sh +7 -0
- data/shell.nix +17 -12
- data/sorbet/config +4 -0
- data/sorbet/{rbi/gems → dry-monads-sorbet}/dry-monads.rbi +176 -94
- data/sorbet/rbi/gems/activemodel@6.1.4.1.rbi +1292 -0
- data/sorbet/rbi/gems/activerecord@6.1.4.1.rbi +8092 -0
- data/sorbet/rbi/gems/activesupport@6.1.4.1.rbi +3531 -0
- data/sorbet/rbi/gems/{ast.rbi → ast@2.4.2.rbi} +28 -22
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +1568 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +1005 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.9.rbi +915 -0
- data/sorbet/rbi/gems/diff-lcs@1.4.4.rbi +8 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +54 -0
- data/sorbet/rbi/gems/dry-core@0.7.1.rbi +92 -0
- data/sorbet/rbi/gems/dry-equalizer@0.3.0.rbi +28 -0
- data/sorbet/rbi/gems/dry-matcher@0.9.0.rbi +56 -0
- data/sorbet/rbi/gems/dry-monads-sorbet@1.1.7.rbi +41 -0
- data/sorbet/rbi/gems/dry-monads@1.4.0.rbi +697 -0
- data/sorbet/rbi/gems/em-websocket@0.5.2.rbi +8 -0
- data/sorbet/rbi/gems/eventmachine@1.2.7.rbi +45 -0
- data/sorbet/rbi/gems/ffi@1.15.4.rbi +8 -0
- data/sorbet/rbi/gems/formatador@0.3.0.rbi +8 -0
- data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +31 -0
- data/sorbet/rbi/gems/guard-livereload@2.5.2.rbi +8 -0
- data/sorbet/rbi/gems/guard-rspec@4.7.3.rbi +211 -0
- data/sorbet/rbi/gems/guard@2.18.0.rbi +8 -0
- data/sorbet/rbi/gems/http_parser.rb@0.6.0.rbi +8 -0
- data/sorbet/rbi/gems/i18n@1.8.10.rbi +8 -0
- data/sorbet/rbi/gems/listen@3.7.0.rbi +8 -0
- data/sorbet/rbi/gems/lumberjack@1.2.8.rbi +8 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +72 -0
- data/sorbet/rbi/gems/minitest@5.14.4.rbi +344 -0
- data/sorbet/rbi/gems/multi_json@1.15.0.rbi +8 -0
- data/sorbet/rbi/gems/nenv@0.3.0.rbi +8 -0
- data/sorbet/rbi/gems/notiffany@0.1.3.rbi +8 -0
- data/sorbet/rbi/gems/parallel@1.21.0.rbi +113 -0
- data/sorbet/rbi/gems/{parser.rbi → parser@3.0.2.0.rbi} +966 -699
- data/sorbet/rbi/gems/pry-byebug@3.9.0.rbi +461 -0
- data/sorbet/rbi/gems/{pry.rbi → pry@0.13.1.rbi} +2191 -1605
- data/sorbet/rbi/gems/{rainbow.rbi → rainbow@3.0.0.rbi} +90 -55
- data/sorbet/rbi/gems/{rake.rbi → rake@13.0.6.rbi} +578 -427
- data/sorbet/rbi/gems/rb-fsevent@0.11.0.rbi +8 -0
- data/sorbet/rbi/gems/rb-inotify@0.10.1.rbi +8 -0
- data/sorbet/rbi/gems/rb-readline@0.5.5.rbi +884 -0
- data/sorbet/rbi/gems/rbi@0.0.6.rbi +1405 -0
- data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +1120 -0
- data/sorbet/rbi/gems/{rexml.rbi → rexml@3.2.5.rbi} +562 -479
- data/sorbet/rbi/gems/{rspec-core.rbi → rspec-core@3.10.1.rbi} +2317 -1533
- data/sorbet/rbi/gems/rspec-expectations@3.10.1.rbi +1574 -0
- data/sorbet/rbi/gems/rspec-mocks@3.10.2.rbi +1462 -0
- data/sorbet/rbi/gems/rspec-support@3.10.2.rbi +509 -0
- data/sorbet/rbi/gems/rspec@3.10.0.rbi +38 -0
- data/sorbet/rbi/gems/rubocop-ast@1.12.0.rbi +1938 -0
- data/sorbet/rbi/gems/rubocop-rspec@2.5.0.rbi +1786 -0
- data/sorbet/rbi/gems/rubocop@1.22.1.rbi +13252 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +405 -0
- data/sorbet/rbi/gems/shellany@0.0.1.rbi +8 -0
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +89 -0
- data/sorbet/rbi/gems/simplecov@0.21.2.rbi +577 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +8 -0
- data/sorbet/rbi/gems/sorbet-struct-comparable@1.1.0.rbi +17 -0
- data/sorbet/rbi/gems/spoom@1.1.5.rbi +1241 -0
- data/sorbet/rbi/gems/stackprof@0.2.17.rbi +98 -0
- data/sorbet/rbi/gems/tapioca@0.5.2.rbi +949 -0
- data/sorbet/rbi/gems/thor@1.1.0.rbi +839 -0
- data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +8 -0
- data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +26 -0
- data/sorbet/rbi/gems/unparser@0.6.0.rbi +8 -0
- data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +8 -0
- data/sorbet/tapioca/require.rb +9 -0
- metadata +88 -91
- data/.ruby-version +0 -1
- data/lib/clean_architecture/entities/targeted_parameters.rb +0 -24
- data/lib/clean_architecture/entities/untargeted_parameters.rb +0 -21
- data/lib/clean_architecture/interfaces/all.rb +0 -12
- data/lib/clean_architecture/interfaces/authorization_parameters.rb +0 -19
- data/lib/clean_architecture/interfaces/base_parameters.rb +0 -24
- data/lib/clean_architecture/interfaces/jsonable.rb +0 -16
- data/lib/clean_architecture/interfaces/targeted_parameters.rb +0 -19
- data/lib/clean_architecture/interfaces/use_case.rb +0 -20
- data/lib/clean_architecture/interfaces/use_case_actor.rb +0 -20
- data/lib/clean_architecture/interfaces/use_case_target.rb +0 -24
- data/lib/clean_architecture/types.rb +0 -8
- data/lib/clean_architecture/use_cases/abstract_use_case.rb +0 -63
- data/lib/clean_architecture/use_cases/all.rb +0 -10
- data/lib/clean_architecture/use_cases/contract.rb +0 -9
- data/lib/clean_architecture/use_cases/errors.rb +0 -58
- data/lib/clean_architecture/use_cases/form.rb +0 -116
- data/lib/clean_architecture/use_cases/parameters.rb +0 -43
- data/sorbet/rbi/gems/activemodel.rbi +0 -75
- data/sorbet/rbi/gems/activesupport.rbi +0 -440
- data/sorbet/rbi/gems/byebug.rbi +0 -1040
- data/sorbet/rbi/gems/coderay.rbi +0 -92
- data/sorbet/rbi/gems/concurrent-ruby.rbi +0 -1586
- data/sorbet/rbi/gems/docile.rbi +0 -32
- data/sorbet/rbi/gems/dry-configurable.rbi +0 -139
- data/sorbet/rbi/gems/dry-container.rbi +0 -89
- data/sorbet/rbi/gems/dry-core.rbi +0 -80
- data/sorbet/rbi/gems/dry-equalizer.rbi +0 -26
- data/sorbet/rbi/gems/dry-inflector.rbi +0 -73
- data/sorbet/rbi/gems/dry-initializer.rbi +0 -209
- data/sorbet/rbi/gems/dry-logic.rbi +0 -305
- data/sorbet/rbi/gems/dry-matcher.rbi +0 -34
- data/sorbet/rbi/gems/dry-schema.rbi +0 -786
- data/sorbet/rbi/gems/dry-struct.rbi +0 -137
- data/sorbet/rbi/gems/dry-types.rbi +0 -709
- data/sorbet/rbi/gems/dry-validation.rbi +0 -288
- data/sorbet/rbi/gems/duckface-interfaces.rbi +0 -94
- data/sorbet/rbi/gems/i18n.rbi +0 -133
- data/sorbet/rbi/gems/jaro_winkler.rbi +0 -15
- data/sorbet/rbi/gems/method_source.rbi +0 -64
- data/sorbet/rbi/gems/parallel.rbi +0 -82
- data/sorbet/rbi/gems/pry-byebug.rbi +0 -155
- data/sorbet/rbi/gems/rb-readline.rbi +0 -767
- data/sorbet/rbi/gems/rspec-expectations.rbi +0 -398
- data/sorbet/rbi/gems/rspec-mocks.rbi +0 -816
- data/sorbet/rbi/gems/rspec-support.rbi +0 -271
- data/sorbet/rbi/gems/rspec.rbi +0 -15
- data/sorbet/rbi/gems/rubocop-rspec.rbi +0 -922
- data/sorbet/rbi/gems/rubocop.rbi +0 -7319
- data/sorbet/rbi/gems/ruby-progressbar.rbi +0 -305
- data/sorbet/rbi/gems/simplecov-html.rbi +0 -35
- data/sorbet/rbi/gems/simplecov.rbi +0 -361
- data/sorbet/rbi/gems/stackprof.rbi +0 -52
- data/sorbet/rbi/gems/unicode-display_width.rbi +0 -17
- data/sorbet/rbi/hidden-definitions/errors.txt +0 -8580
- data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -17036
- data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +0 -452
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6.0.0.rc1/activesupport.rbi +0 -23
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +0 -979
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +0 -108
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +0 -276
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
- data/sorbet/rbi/todo.rbi +0 -10
@@ -1,979 +0,0 @@
|
|
1
|
-
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
|
2
|
-
# srb rbi sorbet-typed
|
3
|
-
#
|
4
|
-
# If you would like to make changes to this file, great! Please upstream any changes you make here:
|
5
|
-
#
|
6
|
-
# https://github.com/sorbet/sorbet-typed/edit/master/lib/activesupport/all/activesupport.rbi
|
7
|
-
#
|
8
|
-
# typed: 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
|
-
# returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
|
164
|
-
sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
|
165
|
-
def in_time_zone(zone = ::Time.zone); end
|
166
|
-
|
167
|
-
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
168
|
-
def indent!(amount, indent_string = nil, indent_empty_lines = false); end
|
169
|
-
|
170
|
-
sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) }
|
171
|
-
def indent(amount, indent_string = nil, indent_empty_lines = false); end
|
172
|
-
|
173
|
-
sig { returns(ActiveSupport::StringInquirer) }
|
174
|
-
def inquiry; end
|
175
|
-
|
176
|
-
sig { returns(T::Boolean) }
|
177
|
-
def is_utf8?; end
|
178
|
-
|
179
|
-
sig { params(limit: Integer).returns(String) }
|
180
|
-
def last(limit = 1); end
|
181
|
-
|
182
|
-
sig { returns(ActiveSupport::Multibyte::Chars) }
|
183
|
-
def mb_chars; end
|
184
|
-
|
185
|
-
sig { params(separator: String, preserve_case: T::Boolean).returns(String) }
|
186
|
-
def parameterize(separator: "-", preserve_case: false); end
|
187
|
-
|
188
|
-
sig { params(count: T.nilable(Integer), locale: Symbol).returns(String) }
|
189
|
-
def pluralize(count = nil, locale = :en); end
|
190
|
-
|
191
|
-
sig { params(patterns: T.untyped).returns(T.untyped) }
|
192
|
-
def remove!(*patterns); end
|
193
|
-
|
194
|
-
sig { params(patterns: T.untyped).returns(T.untyped) }
|
195
|
-
def remove(*patterns); end
|
196
|
-
|
197
|
-
sig { returns(T.untyped) }
|
198
|
-
def safe_constantize; end
|
199
|
-
|
200
|
-
sig { params(locale: Symbol).returns(String) }
|
201
|
-
def singularize(locale = :en); end
|
202
|
-
|
203
|
-
sig { returns(T.untyped) }
|
204
|
-
def squish!; end
|
205
|
-
|
206
|
-
sig { returns(String) }
|
207
|
-
def squish; end
|
208
|
-
|
209
|
-
# starts_with? is an alias of the core method 'start_with?''
|
210
|
-
sig { params(arg0: String).returns(T::Boolean) }
|
211
|
-
def starts_with?(*arg0); end
|
212
|
-
|
213
|
-
sig { returns(String) }
|
214
|
-
def strip_heredoc; end
|
215
|
-
|
216
|
-
sig { returns(String) }
|
217
|
-
def tableize; end
|
218
|
-
|
219
|
-
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
220
|
-
def titleize(keep_id_suffix: false); end
|
221
|
-
|
222
|
-
# titlecase is an alias of titleize
|
223
|
-
sig { params(keep_id_suffix: T::Boolean).returns(String) }
|
224
|
-
def titlecase(keep_id_suffix: false); end
|
225
|
-
|
226
|
-
sig { params(position: Integer).returns(String) }
|
227
|
-
def to(position); end
|
228
|
-
|
229
|
-
sig { returns(Date) }
|
230
|
-
def to_date; end
|
231
|
-
|
232
|
-
sig { returns(DateTime) }
|
233
|
-
def to_datetime; end
|
234
|
-
|
235
|
-
sig { params(form: Symbol).returns(Time) }
|
236
|
-
def to_time(form = :local); end
|
237
|
-
|
238
|
-
sig { params(truncate_at: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
239
|
-
def truncate(truncate_at, separator: nil, omission: "..."); end
|
240
|
-
|
241
|
-
sig { params(words_count: Integer, separator: T.nilable(T.any(String, Regexp)), omission: String).returns(String) }
|
242
|
-
def truncate_words(words_count, separator: nil, omission: "..."); end
|
243
|
-
|
244
|
-
sig { returns(String) }
|
245
|
-
def underscore; end
|
246
|
-
|
247
|
-
sig { returns(String) }
|
248
|
-
def upcase_first; end
|
249
|
-
end
|
250
|
-
|
251
|
-
class Array
|
252
|
-
sig { returns(T::Boolean) }
|
253
|
-
def blank?; end
|
254
|
-
|
255
|
-
sig { returns(T::Array[T.untyped]) }
|
256
|
-
def deep_dup; end
|
257
|
-
|
258
|
-
sig { returns(T::Hash[T.untyped, T.untyped]) }
|
259
|
-
def extract_options!; end
|
260
|
-
|
261
|
-
sig { returns(Elem) }
|
262
|
-
def fifth; end
|
263
|
-
|
264
|
-
sig { returns(Elem) }
|
265
|
-
def forty_two; end
|
266
|
-
|
267
|
-
sig { returns(Elem) }
|
268
|
-
def fourth; end
|
269
|
-
|
270
|
-
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
271
|
-
def from(position); end
|
272
|
-
|
273
|
-
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
274
|
-
def in_groups(number, fill_with = nil); end
|
275
|
-
|
276
|
-
sig { params(number: Integer, fill_with: T.untyped).returns(T.untyped) }
|
277
|
-
def in_groups_of(number, fill_with = nil); end
|
278
|
-
|
279
|
-
sig { returns(T.untyped) }
|
280
|
-
def inquiry; end
|
281
|
-
|
282
|
-
sig { returns(Elem) }
|
283
|
-
def second; end
|
284
|
-
|
285
|
-
sig { returns(Elem) }
|
286
|
-
def second_to_last; end
|
287
|
-
|
288
|
-
sig do
|
289
|
-
params(
|
290
|
-
value: T.untyped,
|
291
|
-
blk: T.proc.params(arg0: Elem).void
|
292
|
-
).returns(T::Array[Elem])
|
293
|
-
end
|
294
|
-
def split(value = nil, &blk); end
|
295
|
-
|
296
|
-
sig { returns(Elem) }
|
297
|
-
def third; end
|
298
|
-
|
299
|
-
sig { returns(Elem) }
|
300
|
-
def third_to_last; end
|
301
|
-
|
302
|
-
sig { params(position: Integer).returns(T::Array[T.untyped]) }
|
303
|
-
def to(position); end
|
304
|
-
|
305
|
-
# to_default_s is an alias of the core method 'to_s'
|
306
|
-
sig {returns(String)}
|
307
|
-
def to_defaul_s; end
|
308
|
-
|
309
|
-
sig { params(format: Symbol).returns(String) }
|
310
|
-
def to_formatted_s(format = :default); end
|
311
|
-
|
312
|
-
sig { returns(String) }
|
313
|
-
def to_param; end
|
314
|
-
|
315
|
-
sig { params(key: String).returns(String) }
|
316
|
-
def to_query(key); end
|
317
|
-
|
318
|
-
sig do
|
319
|
-
params(
|
320
|
-
words_connector: String,
|
321
|
-
two_words_connector: String,
|
322
|
-
last_word_connector: String,
|
323
|
-
locale: T.nilable(Symbol)
|
324
|
-
).returns(String)
|
325
|
-
end
|
326
|
-
def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: ", and ", locale: nil); end
|
327
|
-
|
328
|
-
sig { params(options: T.untyped).returns(T.untyped) }
|
329
|
-
def to_xml(options = nil); end
|
330
|
-
|
331
|
-
sig { params(elements: T.untyped).returns(T.untyped) }
|
332
|
-
def without(*elements); end
|
333
|
-
end
|
334
|
-
|
335
|
-
module ActiveSupport::NumberHelper
|
336
|
-
sig do
|
337
|
-
params(
|
338
|
-
number: T.any(Integer, Float, String),
|
339
|
-
locale: Symbol,
|
340
|
-
precision: T.nilable(Integer),
|
341
|
-
unit: String,
|
342
|
-
separator: String,
|
343
|
-
delimiter: String,
|
344
|
-
format: String,
|
345
|
-
negative_format: String
|
346
|
-
).returns(String)
|
347
|
-
end
|
348
|
-
def number_to_currency(number, locale: :en, precision: 2, unit: "$", separator: ".", delimiter: ",", format: "%u%n", negative_format: "-%u%n"); end
|
349
|
-
|
350
|
-
sig do
|
351
|
-
params(
|
352
|
-
number: T.any(Integer, Float, String),
|
353
|
-
locale: Symbol,
|
354
|
-
delimiter: String,
|
355
|
-
separator: String,
|
356
|
-
delimiter_pattern: T.nilable(Regexp)
|
357
|
-
).returns(String)
|
358
|
-
end
|
359
|
-
def number_to_delimited(number, locale: :en, delimiter: ",", separator: ".", delimiter_pattern: nil); end
|
360
|
-
|
361
|
-
sig do
|
362
|
-
params(
|
363
|
-
number: T.any(Integer, Float, String),
|
364
|
-
locale: Symbol,
|
365
|
-
precision: T.nilable(Integer),
|
366
|
-
significant: T::Boolean,
|
367
|
-
separator: String,
|
368
|
-
delimiter: String,
|
369
|
-
strip_insignificant_zeros: T::Boolean,
|
370
|
-
units: T.any(T::Hash[T.untyped, T.untyped], String, Symbol),
|
371
|
-
format: String
|
372
|
-
).returns(String)
|
373
|
-
end
|
374
|
-
def number_to_human(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true, units: {}, format: "%n %u"); end
|
375
|
-
|
376
|
-
sig do
|
377
|
-
params(
|
378
|
-
number: T.any(Integer, Float, String),
|
379
|
-
locale: Symbol,
|
380
|
-
precision: T.nilable(Integer),
|
381
|
-
significant: T::Boolean,
|
382
|
-
separator: String,
|
383
|
-
delimiter: String,
|
384
|
-
strip_insignificant_zeros: T::Boolean
|
385
|
-
).returns(String)
|
386
|
-
end
|
387
|
-
def number_to_human_size(number, locale: :en, precision: 3, significant: true, separator: ".", delimiter: "", strip_insignificant_zeros: true); end
|
388
|
-
|
389
|
-
sig do
|
390
|
-
params(
|
391
|
-
number: T.any(Integer, Float, String),
|
392
|
-
locale: Symbol,
|
393
|
-
precision: T.nilable(Integer),
|
394
|
-
significant: T::Boolean,
|
395
|
-
separator: String,
|
396
|
-
delimiter: String,
|
397
|
-
strip_insignificant_zeros: T::Boolean,
|
398
|
-
format: String
|
399
|
-
).returns(String)
|
400
|
-
end
|
401
|
-
def number_to_percentage(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false, format: "%n%"); end
|
402
|
-
|
403
|
-
sig do
|
404
|
-
params(
|
405
|
-
number: T.any(Integer, Float, String),
|
406
|
-
area_code: T::Boolean,
|
407
|
-
delimiter: String,
|
408
|
-
extension: T.nilable(Integer),
|
409
|
-
country_code: T.nilable(Integer),
|
410
|
-
pattern: T.nilable(Regexp)
|
411
|
-
).returns(String)
|
412
|
-
end
|
413
|
-
def number_to_phone(number, area_code: false, delimiter: "-", extension: nil, country_code: nil, pattern: nil); end
|
414
|
-
|
415
|
-
sig do
|
416
|
-
params(
|
417
|
-
number: T.any(Integer, Float, String),
|
418
|
-
locale: Symbol,
|
419
|
-
precision: T.nilable(Integer),
|
420
|
-
significant: T::Boolean,
|
421
|
-
separator: String,
|
422
|
-
delimiter: String,
|
423
|
-
strip_insignificant_zeros: T::Boolean
|
424
|
-
).returns(String)
|
425
|
-
end
|
426
|
-
def number_to_rounded(number, locale: :en, precision: 3, significant: false, separator: ".", delimiter: "", strip_insignificant_zeros: false); end
|
427
|
-
end
|
428
|
-
|
429
|
-
module ActiveSupport::Inflector
|
430
|
-
sig do
|
431
|
-
params(
|
432
|
-
term: String,
|
433
|
-
uppercase_first_letter: T::Boolean
|
434
|
-
).returns(String)
|
435
|
-
end
|
436
|
-
def camelize(term, uppercase_first_letter = true); end
|
437
|
-
|
438
|
-
sig { params(table_name: String).returns(String) }
|
439
|
-
def classify(table_name); end
|
440
|
-
|
441
|
-
sig { params(camel_cased_word: String).returns(T.untyped) }
|
442
|
-
def constantize(camel_cased_word); end
|
443
|
-
|
444
|
-
sig { params(underscored_word: String).returns(String) }
|
445
|
-
def dasherize(underscored_word); end
|
446
|
-
|
447
|
-
sig { params(path: String).returns(String) }
|
448
|
-
def deconstantize(path); end
|
449
|
-
|
450
|
-
sig { params(path: String).returns(String) }
|
451
|
-
def demodulize(path); end
|
452
|
-
|
453
|
-
sig do
|
454
|
-
params(
|
455
|
-
class_name: String,
|
456
|
-
separate_class_name_and_id_with_underscore: T::Boolean
|
457
|
-
).returns(String)
|
458
|
-
end
|
459
|
-
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true); end
|
460
|
-
|
461
|
-
sig do
|
462
|
-
params(
|
463
|
-
lower_case_and_underscored_word: String,
|
464
|
-
capitalize: T::Boolean,
|
465
|
-
keep_id_suffix: T::Boolean
|
466
|
-
).returns(String)
|
467
|
-
end
|
468
|
-
def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false); end
|
469
|
-
|
470
|
-
sig { params(locale: Symbol, blk: T.untyped).returns(T.untyped) }
|
471
|
-
def inflections(locale = :en, &blk); end
|
472
|
-
|
473
|
-
sig { params(number: Integer).returns(String) }
|
474
|
-
def ordinal(number); end
|
475
|
-
|
476
|
-
sig { params(number: Integer).returns(String) }
|
477
|
-
def ordinalize(number); end
|
478
|
-
|
479
|
-
sig do
|
480
|
-
params(
|
481
|
-
string: String,
|
482
|
-
separator: String,
|
483
|
-
preserve_case: T::Boolean,
|
484
|
-
locale: Symbol
|
485
|
-
).returns(String)
|
486
|
-
end
|
487
|
-
def parameterize(string, separator: '-', preserve_case: false, locale: nil); end
|
488
|
-
|
489
|
-
sig { params(word: String, locale: Symbol).returns(String) }
|
490
|
-
def pluralize(word, locale = :en); end
|
491
|
-
|
492
|
-
sig { params(camel_cased_word: String).returns(T.untyped) }
|
493
|
-
def safe_constantize(camel_cased_word); end
|
494
|
-
|
495
|
-
sig { params(word: String, locale: Symbol).returns(String) }
|
496
|
-
def singularize(word, locale = :en); end
|
497
|
-
|
498
|
-
sig { params(class_name: String).returns(String) }
|
499
|
-
def tableize(class_name); end
|
500
|
-
|
501
|
-
sig { params(word: String, keep_id_suffix: T::Boolean).returns(String) }
|
502
|
-
def titleize(word, keep_id_suffix: false); end
|
503
|
-
|
504
|
-
sig { params(string: String, replacement: String, locale: Symbol).returns(String) }
|
505
|
-
def transliterate(string, replacement = '?', locale: nil); end
|
506
|
-
|
507
|
-
sig { params(camel_cased_word: String).returns(String) }
|
508
|
-
def underscore(camel_cased_word); end
|
509
|
-
|
510
|
-
sig { params(string: String).returns(String) }
|
511
|
-
def upcase_first(string); end
|
512
|
-
end
|
513
|
-
|
514
|
-
|
515
|
-
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time/calculations.rb
|
516
|
-
# 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
|
517
|
-
# this is not a complete definition!
|
518
|
-
class ActiveSupport::TimeWithZone
|
519
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
520
|
-
def midnight; end
|
521
|
-
|
522
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
523
|
-
def beginning_of_day; end
|
524
|
-
|
525
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
526
|
-
def at_midnight; end
|
527
|
-
|
528
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
529
|
-
def at_beginning_of_day; end
|
530
|
-
|
531
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
532
|
-
def middle_of_day; end
|
533
|
-
|
534
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
535
|
-
def midday; end
|
536
|
-
|
537
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
538
|
-
def noon; end
|
539
|
-
|
540
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
541
|
-
def at_midday; end
|
542
|
-
|
543
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
544
|
-
def at_noon; end
|
545
|
-
|
546
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
547
|
-
def at_middle_of_day; end
|
548
|
-
|
549
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
550
|
-
def end_of_day; end
|
551
|
-
|
552
|
-
sig { returns(ActiveSupport::TimeWithZone) }
|
553
|
-
def at_end_of_day; end
|
554
|
-
end
|
555
|
-
|
556
|
-
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date
|
557
|
-
# this is not a complete definition!
|
558
|
-
class Date
|
559
|
-
sig { params(options: T::Hash[Symbol, Integer]).returns(Date) }
|
560
|
-
def advance(options); end
|
561
|
-
|
562
|
-
# these are the sigs for Date- in the stdlib
|
563
|
-
# https://github.com/sorbet/sorbet/blob/3910f6cfd9935c9b42e2135e32e15ab8a6e5b9be/rbi/stdlib/date.rbi#L373
|
564
|
-
# note that if more sigs are added to sorbet you should replicate them here
|
565
|
-
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/date.rbi
|
566
|
-
sig {params(arg0: Numeric).returns(T.self_type)}
|
567
|
-
sig {params(arg0: Date).returns(Rational)}
|
568
|
-
# these sigs are added for activesupport users
|
569
|
-
sig {params(arg0: ActiveSupport::Duration).returns(T.self_type)}
|
570
|
-
def -(arg0); end
|
571
|
-
end
|
572
|
-
|
573
|
-
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time
|
574
|
-
# this is not a complete definition!
|
575
|
-
class Time
|
576
|
-
sig { returns(Time) }
|
577
|
-
def midnight; end
|
578
|
-
|
579
|
-
sig { returns(Time) }
|
580
|
-
def beginning_of_day; end
|
581
|
-
|
582
|
-
sig { params(options: T::Hash[Symbol, Integer]).returns(Time) }
|
583
|
-
def advance(options); end
|
584
|
-
|
585
|
-
sig { returns(Time) }
|
586
|
-
def at_midnight; end
|
587
|
-
|
588
|
-
sig { returns(Time) }
|
589
|
-
def at_beginning_of_day; end
|
590
|
-
|
591
|
-
sig { returns(Time) }
|
592
|
-
def middle_of_day; end
|
593
|
-
|
594
|
-
sig { returns(Time) }
|
595
|
-
def midday; end
|
596
|
-
|
597
|
-
sig { returns(Time) }
|
598
|
-
def noon; end
|
599
|
-
|
600
|
-
sig { returns(Time) }
|
601
|
-
def at_midday; end
|
602
|
-
|
603
|
-
sig { returns(Time) }
|
604
|
-
def at_noon; end
|
605
|
-
|
606
|
-
sig { returns(Time) }
|
607
|
-
def at_middle_of_day; end
|
608
|
-
|
609
|
-
# https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
|
610
|
-
# returns Time in the case zone is passed nil and ActiveSupport::TimeWithZone otherwise
|
611
|
-
sig { params(zone: T.nilable(T.any(String, ActiveSupport::TimeZone))).returns(T.any(ActiveSupport::TimeWithZone, Time)) }
|
612
|
-
def in_time_zone(zone = ::Time.zone); end
|
613
|
-
|
614
|
-
# these are the sigs for Time- in the stdlib
|
615
|
-
# https://github.com/sorbet/sorbet/blob/c3691753e4ce545e1eb66cbd3e55de67d8879b98/rbi/core/time.rbi#L347
|
616
|
-
# note that if more sigs are added to sorbet you should replicate them here
|
617
|
-
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/core/time.rbi#L347
|
618
|
-
sig do
|
619
|
-
params(
|
620
|
-
arg0: Time,
|
621
|
-
)
|
622
|
-
.returns(Float)
|
623
|
-
end
|
624
|
-
sig do
|
625
|
-
params(
|
626
|
-
arg0: Numeric,
|
627
|
-
)
|
628
|
-
.returns(Time)
|
629
|
-
end
|
630
|
-
# these sigs are added for activesupport users
|
631
|
-
sig {params(arg0: ActiveSupport::Duration).returns(Time)}
|
632
|
-
def -(arg0); end
|
633
|
-
end
|
634
|
-
|
635
|
-
# defines some of the methods at https://github.com/rails/rails/tree/v6.0.0/activesupport/lib/active_support/core_ext/hash
|
636
|
-
# this is not a complete definition!
|
637
|
-
class Hash
|
638
|
-
sig { returns(T::Hash[String, T.untyped]) }
|
639
|
-
def stringify_keys; end
|
640
|
-
|
641
|
-
sig { returns(T::Hash[String, T.untyped]) }
|
642
|
-
def stringify_keys!; end
|
643
|
-
|
644
|
-
sig { returns(T::Hash[String, T.untyped]) }
|
645
|
-
def deep_stringify_keys; end
|
646
|
-
|
647
|
-
sig { returns(T::Hash[String, T.untyped]) }
|
648
|
-
def deep_stringify_keys!; end
|
649
|
-
|
650
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
651
|
-
def symbolize_keys; end
|
652
|
-
|
653
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
654
|
-
def symbolize_keys!; end
|
655
|
-
|
656
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
657
|
-
def deep_symbolize_keys; end
|
658
|
-
|
659
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
660
|
-
def deep_symbolize_keys!; end
|
661
|
-
|
662
|
-
# in an ideal world, `arg` would be the type of all keys, the 1st `T.untyped` would be
|
663
|
-
# the type of keys your block returns, and the 2nd `T.untyped` would be the type of values
|
664
|
-
# that the hash had.
|
665
|
-
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
666
|
-
def deep_transform_keys(&block); end
|
667
|
-
|
668
|
-
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
669
|
-
def deep_transform_keys!(&block); end
|
670
|
-
|
671
|
-
sig { returns(T::Hash[Symbol, T.untyped]) }
|
672
|
-
def to_options; end
|
673
|
-
end
|
674
|
-
|
675
|
-
class Integer
|
676
|
-
# Returns a Duration instance matching the number of months provided.
|
677
|
-
#
|
678
|
-
# ```ruby
|
679
|
-
# 2.months # => 2 months
|
680
|
-
# ```
|
681
|
-
sig { returns(ActiveSupport::Duration) }
|
682
|
-
def months; end
|
683
|
-
|
684
|
-
sig { returns(ActiveSupport::Duration) }
|
685
|
-
def month; end
|
686
|
-
|
687
|
-
# Returns a Duration instance matching the number of years provided.
|
688
|
-
#
|
689
|
-
# ```ruby
|
690
|
-
# 2.years # => 2 years
|
691
|
-
# ```
|
692
|
-
sig { returns(ActiveSupport::Duration) }
|
693
|
-
def years; end
|
694
|
-
|
695
|
-
sig { returns(ActiveSupport::Duration) }
|
696
|
-
def year; end
|
697
|
-
end
|
698
|
-
|
699
|
-
class Numeric
|
700
|
-
sig { returns(ActiveSupport::Duration) }
|
701
|
-
def second; end
|
702
|
-
|
703
|
-
sig { returns(ActiveSupport::Duration) }
|
704
|
-
def seconds; end
|
705
|
-
|
706
|
-
sig { returns(ActiveSupport::Duration) }
|
707
|
-
def minute; end
|
708
|
-
|
709
|
-
sig { returns(ActiveSupport::Duration) }
|
710
|
-
def minutes; end
|
711
|
-
|
712
|
-
sig { returns(ActiveSupport::Duration) }
|
713
|
-
def hour; end
|
714
|
-
|
715
|
-
sig { returns(ActiveSupport::Duration) }
|
716
|
-
def hours; end
|
717
|
-
|
718
|
-
sig { returns(ActiveSupport::Duration) }
|
719
|
-
def day; end
|
720
|
-
|
721
|
-
sig { returns(ActiveSupport::Duration) }
|
722
|
-
def days; end
|
723
|
-
|
724
|
-
sig { returns(ActiveSupport::Duration) }
|
725
|
-
def week; end
|
726
|
-
|
727
|
-
sig { returns(ActiveSupport::Duration) }
|
728
|
-
def weeks; end
|
729
|
-
|
730
|
-
sig { returns(ActiveSupport::Duration) }
|
731
|
-
def fortnight; end
|
732
|
-
|
733
|
-
sig { returns(ActiveSupport::Duration) }
|
734
|
-
def fortnights; end
|
735
|
-
|
736
|
-
sig { returns(T.self_type) }
|
737
|
-
def in_milliseconds; end
|
738
|
-
|
739
|
-
KILOBYTE = T.let(1024, Integer)
|
740
|
-
MEGABYTE = T.let(KILOBYTE * 1024, Integer)
|
741
|
-
GIGABYTE = T.let(MEGABYTE * 1024, Integer)
|
742
|
-
TERABYTE = T.let(GIGABYTE * 1024, Integer)
|
743
|
-
PETABYTE = T.let(TERABYTE * 1024, Integer)
|
744
|
-
EXABYTE = T.let(PETABYTE * 1024, Integer)
|
745
|
-
|
746
|
-
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
747
|
-
#
|
748
|
-
# ```ruby
|
749
|
-
# 2.bytes # => 2
|
750
|
-
# ```
|
751
|
-
sig { returns(T.self_type) }
|
752
|
-
def byte; end
|
753
|
-
|
754
|
-
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
755
|
-
#
|
756
|
-
# ```ruby
|
757
|
-
# 2.bytes # => 2
|
758
|
-
# ```
|
759
|
-
sig { returns(T.self_type) }
|
760
|
-
def bytes; end
|
761
|
-
|
762
|
-
# Returns the number of bytes equivalent to the kilobytes provided.
|
763
|
-
#
|
764
|
-
# ```ruby
|
765
|
-
# 2.kilobytes # => 2048
|
766
|
-
# ```
|
767
|
-
sig { returns(T.self_type) }
|
768
|
-
def kilobyte; end
|
769
|
-
|
770
|
-
# Returns the number of bytes equivalent to the kilobytes provided.
|
771
|
-
#
|
772
|
-
# ```ruby
|
773
|
-
# 2.kilobytes # => 2048
|
774
|
-
# ```
|
775
|
-
sig { returns(T.self_type) }
|
776
|
-
def kilobytes; end
|
777
|
-
|
778
|
-
# Returns the number of bytes equivalent to the megabytes provided.
|
779
|
-
#
|
780
|
-
# ```ruby
|
781
|
-
# 2.megabytes # => 2_097_152
|
782
|
-
# ```
|
783
|
-
sig { returns(T.self_type) }
|
784
|
-
def megabyte; end
|
785
|
-
|
786
|
-
# Returns the number of bytes equivalent to the megabytes provided.
|
787
|
-
#
|
788
|
-
# ```ruby
|
789
|
-
# 2.megabytes # => 2_097_152
|
790
|
-
# ```
|
791
|
-
sig { returns(T.self_type) }
|
792
|
-
def megabytes; end
|
793
|
-
|
794
|
-
# Returns the number of bytes equivalent to the gigabytes provided.
|
795
|
-
#
|
796
|
-
# ```ruby
|
797
|
-
# 2.gigabytes # => 2_147_483_648
|
798
|
-
# ```
|
799
|
-
sig { returns(T.self_type) }
|
800
|
-
def gigabyte; end
|
801
|
-
|
802
|
-
# Returns the number of bytes equivalent to the gigabytes provided.
|
803
|
-
#
|
804
|
-
# ```ruby
|
805
|
-
# 2.gigabytes # => 2_147_483_648
|
806
|
-
# ```
|
807
|
-
sig { returns(T.self_type) }
|
808
|
-
def gigabytes; end
|
809
|
-
|
810
|
-
# Returns the number of bytes equivalent to the terabytes provided.
|
811
|
-
#
|
812
|
-
# ```ruby
|
813
|
-
# 2.terabytes # => 2_199_023_255_552
|
814
|
-
# ```
|
815
|
-
sig { returns(T.self_type) }
|
816
|
-
def terabyte; end
|
817
|
-
|
818
|
-
# Returns the number of bytes equivalent to the terabytes provided.
|
819
|
-
#
|
820
|
-
# ```ruby
|
821
|
-
# 2.terabytes # => 2_199_023_255_552
|
822
|
-
# ```
|
823
|
-
sig { returns(T.self_type) }
|
824
|
-
def terabytes; end
|
825
|
-
|
826
|
-
# Returns the number of bytes equivalent to the petabytes provided.
|
827
|
-
#
|
828
|
-
# ```ruby
|
829
|
-
# 2.petabytes # => 2_251_799_813_685_248
|
830
|
-
# ```
|
831
|
-
sig { returns(T.self_type) }
|
832
|
-
def petabyte; end
|
833
|
-
|
834
|
-
# Returns the number of bytes equivalent to the petabytes provided.
|
835
|
-
#
|
836
|
-
# ```ruby
|
837
|
-
# 2.petabytes # => 2_251_799_813_685_248
|
838
|
-
# ```
|
839
|
-
sig { returns(T.self_type) }
|
840
|
-
def petabytes; end
|
841
|
-
|
842
|
-
# Returns the number of bytes equivalent to the exabytes provided.
|
843
|
-
#
|
844
|
-
# ```ruby
|
845
|
-
# 2.exabytes # => 2_305_843_009_213_693_952
|
846
|
-
# ```
|
847
|
-
sig { returns(T.self_type) }
|
848
|
-
def exabyte; end
|
849
|
-
|
850
|
-
# Returns the number of bytes equivalent to the exabytes provided.
|
851
|
-
#
|
852
|
-
# ```ruby
|
853
|
-
# 2.exabytes # => 2_305_843_009_213_693_952
|
854
|
-
# ```
|
855
|
-
sig { returns(T.self_type) }
|
856
|
-
def exabytes; end
|
857
|
-
end
|
858
|
-
|
859
|
-
module Enumerable
|
860
|
-
# https://github.com/rails/rails/blob/v5.2.3/activesupport/lib/active_support/core_ext/enumerable.rb#L64..L72
|
861
|
-
# the case where a block isn't given isn't handled - that seems like an unlikely case
|
862
|
-
sig do
|
863
|
-
type_parameters(:key).params(
|
864
|
-
block: T.proc.params(o: Enumerable::Elem).returns(T.type_parameter(:key))
|
865
|
-
).returns(
|
866
|
-
T::Hash[T.type_parameter(:key), Enumerable::Elem]
|
867
|
-
)
|
868
|
-
end
|
869
|
-
def index_by(&block); end
|
870
|
-
end
|
871
|
-
|
872
|
-
class ActiveSupport::Duration
|
873
|
-
# Returns the number of seconds that this Duration represents.
|
874
|
-
#
|
875
|
-
# ```ruby
|
876
|
-
# 1.minute.to_i # => 60
|
877
|
-
# 1.hour.to_i # => 3600
|
878
|
-
# 1.day.to_i # => 86400
|
879
|
-
# ```
|
880
|
-
#
|
881
|
-
# Note that this conversion makes some assumptions about the
|
882
|
-
# duration of some periods, e.g. months are always 1/12 of year
|
883
|
-
# and years are 365.2425 days:
|
884
|
-
#
|
885
|
-
# ```ruby
|
886
|
-
# # equivalent to (1.year / 12).to_i
|
887
|
-
# 1.month.to_i # => 2629746
|
888
|
-
#
|
889
|
-
# # equivalent to 365.2425.days.to_i
|
890
|
-
# 1.year.to_i # => 31556952
|
891
|
-
# ```
|
892
|
-
#
|
893
|
-
# In such cases, Ruby's core
|
894
|
-
# [Date](https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html) and
|
895
|
-
# [Time](https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html) should be used for precision
|
896
|
-
# date and time arithmetic.
|
897
|
-
sig { returns(Integer) }
|
898
|
-
def to_i; end
|
899
|
-
|
900
|
-
sig { returns(Float) }
|
901
|
-
def to_f; end
|
902
|
-
|
903
|
-
# Returns the amount of seconds a duration covers as a string.
|
904
|
-
# For more information check to_i method.
|
905
|
-
#
|
906
|
-
# ```ruby
|
907
|
-
# 1.day.to_s # => "86400"
|
908
|
-
# ```
|
909
|
-
sig { returns(String) }
|
910
|
-
def to_s; end
|
911
|
-
|
912
|
-
# Creates a new Duration from string formatted according to ISO 8601 Duration.
|
913
|
-
#
|
914
|
-
# See [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) for more information.
|
915
|
-
# This method allows negative parts to be present in pattern.
|
916
|
-
# If invalid string is provided, it will raise `ActiveSupport::Duration::ISO8601Parser::ParsingError`.
|
917
|
-
sig { params(iso8601duration: String).returns(ActiveSupport::Duration) }
|
918
|
-
def self.parse(iso8601duration); end
|
919
|
-
|
920
|
-
# Creates a new Duration from a seconds value that is converted
|
921
|
-
# to the individual parts:
|
922
|
-
#
|
923
|
-
# ```ruby
|
924
|
-
# ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
|
925
|
-
# ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
|
926
|
-
# ```
|
927
|
-
sig { params(value: Numeric).returns(ActiveSupport::Duration) }
|
928
|
-
def self.build(value); end
|
929
|
-
|
930
|
-
# Returns `true` if `other` is also a Duration instance, which has the
|
931
|
-
# same parts as this one.
|
932
|
-
sig { params(other: T.untyped).returns(T::Boolean) }
|
933
|
-
def eql?(other); end
|
934
|
-
|
935
|
-
# Compares one Duration with another or a Numeric to this Duration.
|
936
|
-
# Numeric values are treated as seconds.
|
937
|
-
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(Integer) }
|
938
|
-
def <=>(other); end
|
939
|
-
|
940
|
-
# Adds another Duration or a Numeric to this Duration. Numeric values
|
941
|
-
# are treated as seconds.
|
942
|
-
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
943
|
-
def +(other); end
|
944
|
-
|
945
|
-
# Subtracts another Duration or a Numeric from this Duration. Numeric
|
946
|
-
# values are treated as seconds.
|
947
|
-
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
948
|
-
def -(other); end
|
949
|
-
|
950
|
-
# Multiplies this Duration by a Numeric and returns a new Duration.
|
951
|
-
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
952
|
-
def *(other); end
|
953
|
-
|
954
|
-
# Divides this Duration by a Numeric and returns a new Duration.
|
955
|
-
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
956
|
-
def /(other); end
|
957
|
-
|
958
|
-
# Returns the modulo of this Duration by another Duration or Numeric.
|
959
|
-
# Numeric values are treated as seconds.
|
960
|
-
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
961
|
-
def %(other); end
|
962
|
-
|
963
|
-
# Returns `true` if `other` is also a Duration instance with the
|
964
|
-
# same `value`, or if `other == value`.
|
965
|
-
sig { params(other: T.untyped).returns(T::Boolean) }
|
966
|
-
def ==(other); end
|
967
|
-
|
968
|
-
# Build ISO 8601 Duration string for this duration.
|
969
|
-
# The `precision` parameter can be used to limit seconds' precision of duration.
|
970
|
-
sig { params(precision: T.nilable(Integer)).returns(String) }
|
971
|
-
def iso8601(precision: nil); end
|
972
|
-
end
|
973
|
-
|
974
|
-
module Benchmark
|
975
|
-
extend T::Sig
|
976
|
-
|
977
|
-
sig { params(block: T.proc.void).returns(Float) }
|
978
|
-
def self.ms(&block); end
|
979
|
-
end
|