titleist 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +19 -0
- data/.gitignore +1 -2
- data/.rubocop.yml +26 -1
- data/.ruby-version +1 -1
- data/Gemfile +13 -2
- data/README.md +95 -25
- data/Rakefile +17 -6
- data/docs/index.md +7 -0
- data/lib/generators/titleist/titleist_generator.rb +3 -0
- data/lib/titleist.rb +14 -9
- data/lib/titleist/controller.rb +36 -0
- data/lib/titleist/engine.rb +10 -4
- data/lib/titleist/helper.rb +23 -0
- data/lib/titleist/title.rb +52 -89
- data/lib/titleist/version.rb +5 -1
- data/rbi/sord.rbi +117 -0
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/actioncable.rbi +318 -0
- data/sorbet/rbi/gems/actionmailbox.rbi +56 -0
- data/sorbet/rbi/gems/actionmailer.rbi +446 -0
- data/sorbet/rbi/gems/actionpack.rbi +3411 -0
- data/sorbet/rbi/gems/actiontext.rbi +79 -0
- data/sorbet/rbi/gems/actionview.rbi +1185 -0
- data/sorbet/rbi/gems/activejob.rbi +362 -0
- data/sorbet/rbi/gems/activemodel.rbi +749 -0
- data/sorbet/rbi/gems/activerecord.rbi +5713 -0
- data/sorbet/rbi/gems/activestorage.rbi +221 -0
- data/sorbet/rbi/gems/activesupport.rbi +2437 -0
- data/sorbet/rbi/gems/addressable.rbi +146 -0
- data/sorbet/rbi/gems/ast.rbi +47 -0
- data/sorbet/rbi/gems/capybara.rbi +1787 -0
- data/sorbet/rbi/gems/childprocess.rbi +106 -0
- data/sorbet/rbi/gems/codeclimate-test-reporter.rbi +125 -0
- data/sorbet/rbi/gems/concurrent-ruby.rbi +1587 -0
- data/sorbet/rbi/gems/crass.rbi +92 -0
- data/sorbet/rbi/gems/docile.rbi +29 -0
- data/sorbet/rbi/gems/erubi.rbi +26 -0
- data/sorbet/rbi/gems/globalid.rbi +98 -0
- data/sorbet/rbi/gems/i18n.rbi +191 -0
- data/sorbet/rbi/gems/jaro_winkler.rbi +14 -0
- data/sorbet/rbi/gems/loofah.rbi +129 -0
- data/sorbet/rbi/gems/mail.rbi +1582 -0
- data/sorbet/rbi/gems/marcel.rbi +12 -0
- data/sorbet/rbi/gems/method_source.rbi +63 -0
- data/sorbet/rbi/gems/mini_mime.rbi +51 -0
- data/sorbet/rbi/gems/minitest.rbi +419 -0
- data/sorbet/rbi/gems/mocha.rbi +794 -0
- data/sorbet/rbi/gems/nio4r.rbi +67 -0
- data/sorbet/rbi/gems/nokogiri.rbi +1010 -0
- data/sorbet/rbi/gems/parallel.rbi +81 -0
- data/sorbet/rbi/gems/parser.rbi +920 -0
- data/sorbet/rbi/gems/public_suffix.rbi +103 -0
- data/sorbet/rbi/gems/puma.rbi +586 -0
- data/sorbet/rbi/gems/rack-test.rbi +161 -0
- data/sorbet/rbi/gems/rack.rbi +634 -0
- data/sorbet/rbi/gems/rails-dom-testing.rbi +67 -0
- data/sorbet/rbi/gems/rails-html-sanitizer.rbi +91 -0
- data/sorbet/rbi/gems/railties.rbi +834 -0
- data/sorbet/rbi/gems/rainbow.rbi +117 -0
- data/sorbet/rbi/gems/rake.rbi +269 -0
- data/sorbet/rbi/gems/regexp_parser.rbi +912 -0
- data/sorbet/rbi/gems/rubocop.rbi +7232 -0
- data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
- data/sorbet/rbi/gems/rubyzip.rbi +546 -0
- data/sorbet/rbi/gems/selenium-webdriver.rbi +1450 -0
- data/sorbet/rbi/gems/simplecov-html.rbi +30 -0
- data/sorbet/rbi/gems/simplecov.rbi +189 -0
- data/sorbet/rbi/gems/site_ruby.rbi +265 -0
- data/sorbet/rbi/gems/sprockets-rails.rbi +105 -0
- data/sorbet/rbi/gems/sprockets.rbi +753 -0
- data/sorbet/rbi/gems/sqlite3.rbi +353 -0
- data/sorbet/rbi/gems/thor.rbi +579 -0
- data/sorbet/rbi/gems/thread_safe.rbi +81 -0
- data/sorbet/rbi/gems/tzinfo.rbi +405 -0
- data/sorbet/rbi/gems/unicode-display_width.rbi +16 -0
- data/sorbet/rbi/gems/webdrivers.rbi +155 -0
- data/sorbet/rbi/gems/xpath.rbi +158 -0
- data/sorbet/rbi/gems/yard.rbi +1159 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +14957 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +24898 -0
- data/sorbet/rbi/sorbet-typed/lib/actionmailer/all/actionmailer.rbi +13 -0
- data/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +938 -0
- data/sorbet/rbi/sorbet-typed/lib/actionview/all/actionview.rbi +314 -0
- data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +425 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5.2/activerecord.rbi +17 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1425 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/~>6.0.0/activerecord.rbi +475 -0
- data/sorbet/rbi/sorbet-typed/lib/activestorage/>=6.0.0/activestorage.rbi +19 -0
- data/sorbet/rbi/sorbet-typed/lib/activestorage/all/activestorage.rbi +173 -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 +858 -0
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +8684 -0
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
- data/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +25 -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 +20 -0
- data/titleist.gemspec +3 -14
- metadata +96 -155
- data/.travis.yml +0 -45
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/helpers/titleist_helper.rb +0 -47
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
@@ -0,0 +1,19 @@
|
|
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/activestorage/>=6.0.0/activestorage.rbi
|
7
|
+
#
|
8
|
+
# typed: strong
|
9
|
+
|
10
|
+
class ActiveStorage::Attached::One
|
11
|
+
sig { returns(T::Boolean) }
|
12
|
+
def blank?; end
|
13
|
+
end
|
14
|
+
|
15
|
+
class ActiveStorage::Attached::Many
|
16
|
+
# Returns all attached blobs.
|
17
|
+
sig { returns(T::Array[T.untyped]) }
|
18
|
+
def blobs; end
|
19
|
+
end
|
@@ -0,0 +1,173 @@
|
|
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/activestorage/all/activestorage.rbi
|
7
|
+
#
|
8
|
+
# typed: strong
|
9
|
+
|
10
|
+
module ActiveStorage
|
11
|
+
sig { returns(Gem::Version) }
|
12
|
+
def self.gem_version; end
|
13
|
+
|
14
|
+
sig { returns(Gem::Version) }
|
15
|
+
def self.version; end
|
16
|
+
end
|
17
|
+
|
18
|
+
class ActiveStorage::Attached::One
|
19
|
+
# These aren't technically included, but Attached::One delegates any missing
|
20
|
+
# methods to Attachment, which in turn delegates to Blob. This is essentially
|
21
|
+
# a hack to make it easier to maintain the ActiveStorage signatures. We can't
|
22
|
+
#include Blob directly because it's a class, so `include`ing it doesn't work.
|
23
|
+
include ActiveStorage::Blob::Analyzable
|
24
|
+
include ActiveStorage::Blob::Identifiable
|
25
|
+
include ActiveStorage::Blob::Representable
|
26
|
+
|
27
|
+
# Attaches an `attachable` to the record.
|
28
|
+
#
|
29
|
+
# If the record is persisted and unchanged, the attachment is saved to
|
30
|
+
# the database immediately. Otherwise, it'll be saved to the DB when the
|
31
|
+
# record is next saved.
|
32
|
+
#
|
33
|
+
# ```ruby
|
34
|
+
# person.avatar.attach(params[:avatar]) # ActionDispatch::Http::UploadedFile object
|
35
|
+
# person.avatar.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload
|
36
|
+
# person.avatar.attach(io: File.open("/path/to/face.jpg"), filename: "face.jpg", content_type: "image/jpg")
|
37
|
+
# person.avatar.attach(avatar_blob) # ActiveStorage::Blob object
|
38
|
+
# ```
|
39
|
+
sig { params(attachable: T.untyped).void }
|
40
|
+
def attach(attachable); end
|
41
|
+
|
42
|
+
# Returns `true` if an attachment has been made.
|
43
|
+
#
|
44
|
+
# ```ruby
|
45
|
+
# class User < ApplicationRecord
|
46
|
+
# has_one_attached :avatar
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# User.new.avatar.attached? # => false
|
50
|
+
# ```
|
51
|
+
sig { returns(T::Boolean) }
|
52
|
+
def attached?; end
|
53
|
+
|
54
|
+
# Returns the associated attachment record.
|
55
|
+
#
|
56
|
+
# You don't have to call this method to access the attachment's methods as
|
57
|
+
# they are all available at the model level.
|
58
|
+
sig { returns(T.nilable(ActiveStorage::Attachment)) }
|
59
|
+
def attachment; end
|
60
|
+
|
61
|
+
# Deletes the attachment without purging it, leaving its blob in place.
|
62
|
+
sig { void }
|
63
|
+
def detach; end
|
64
|
+
|
65
|
+
# Directly purges the attachment (i.e. destroys the blob and
|
66
|
+
# attachment and deletes the file on the service).
|
67
|
+
sig { void }
|
68
|
+
def purge; end
|
69
|
+
|
70
|
+
# Purges the attachment through the queuing system.
|
71
|
+
sig { void }
|
72
|
+
def purge_later; end
|
73
|
+
end
|
74
|
+
|
75
|
+
class ActiveStorage::Attached::Many
|
76
|
+
# These aren't technically included, but Attached::Many delegates any missing
|
77
|
+
# methods to Attachment, which in turn delegates to Blob. This is essentially
|
78
|
+
# a hack to make it easier to maintain the ActiveStorage signatures. We can't
|
79
|
+
# include Blob directly because it's a class, so `include`ing it doesn't work.
|
80
|
+
include ActiveStorage::Blob::Analyzable
|
81
|
+
include ActiveStorage::Blob::Identifiable
|
82
|
+
include ActiveStorage::Blob::Representable
|
83
|
+
|
84
|
+
# Attaches one or more `attachables` to the record.
|
85
|
+
#
|
86
|
+
# If the record is persisted and unchanged, the attachments are saved to
|
87
|
+
# the database immediately. Otherwise, they'll be saved to the DB when the
|
88
|
+
# record is next saved.
|
89
|
+
#
|
90
|
+
# ```ruby
|
91
|
+
# document.images.attach(params[:images]) # Array of ActionDispatch::Http::UploadedFile objects
|
92
|
+
# document.images.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload
|
93
|
+
# document.images.attach(io: File.open("/path/to/racecar.jpg"), filename: "racecar.jpg", content_type: "image/jpg")
|
94
|
+
# document.images.attach([ first_blob, second_blob ])
|
95
|
+
# ```
|
96
|
+
sig { params(attachables: T.untyped).void }
|
97
|
+
def attach(*attachables); end
|
98
|
+
|
99
|
+
# Returns `true` if any attachments have been made.
|
100
|
+
#
|
101
|
+
# ```ruby
|
102
|
+
# class Gallery < ApplicationRecord
|
103
|
+
# has_many_attached :photos
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# Gallery.new.photos.attached? # => false
|
107
|
+
# ```
|
108
|
+
sig { returns(T::Boolean) }
|
109
|
+
def attached?; end
|
110
|
+
|
111
|
+
# Returns all the associated attachment records.
|
112
|
+
#
|
113
|
+
# All methods called on this proxy object that aren't listed here will automatically be delegated to `attachments`.
|
114
|
+
sig { returns(T.nilable(T::Array[ActiveStorage::Attachment])) }
|
115
|
+
def attachments; end
|
116
|
+
|
117
|
+
# Deletes associated attachments without purging them, leaving their respective blobs in place.
|
118
|
+
sig { void }
|
119
|
+
def detach; end
|
120
|
+
|
121
|
+
# Directly purges each associated attachment (i.e. destroys the blobs and
|
122
|
+
# attachments and deletes the files on the service).
|
123
|
+
sig { void }
|
124
|
+
def purge; end
|
125
|
+
|
126
|
+
# Purges each associated attachment through the queuing system.
|
127
|
+
sig { void }
|
128
|
+
def purge_later; end
|
129
|
+
end
|
130
|
+
|
131
|
+
module ActiveStorage::Blob::Representable
|
132
|
+
# Returns an ActiveStorage::Variant instance with the set of `transformations` provided. This is only relevant for image
|
133
|
+
# files, and it allows any image to be transformed for size, colors, and the like. Example:
|
134
|
+
#
|
135
|
+
# ```ruby
|
136
|
+
# avatar.variant(resize_to_limit: [100, 100]).processed.service_url
|
137
|
+
# ```
|
138
|
+
#
|
139
|
+
# This will create and process a variant of the avatar blob that's constrained to a height and width of 100px.
|
140
|
+
# Then it'll upload said variant to the service according to a derivative key of the blob and the transformations.
|
141
|
+
#
|
142
|
+
# Frequently, though, you don't actually want to transform the variant right away. But rather simply refer to a
|
143
|
+
# specific variant that can be created by a controller on-demand. Like so:
|
144
|
+
#
|
145
|
+
# ```ruby
|
146
|
+
# <%= image_tag Current.user.avatar.variant(resize_to_limit: [100, 100]) %>
|
147
|
+
# ```
|
148
|
+
#
|
149
|
+
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::RepresentationsController
|
150
|
+
# can then produce on-demand.
|
151
|
+
#
|
152
|
+
# Raises ActiveStorage::InvariableError if ImageMagick cannot transform the blob. To determine whether a blob is
|
153
|
+
# variable, call ActiveStorage::Blob#variable?.
|
154
|
+
sig { params(transformations: T.untyped).returns(ActiveStorage::Variant) }
|
155
|
+
def variant(transformations); end
|
156
|
+
end
|
157
|
+
|
158
|
+
class ActiveStorage::Attachment < ActiveRecord::Base
|
159
|
+
# These aren't technically included, but Attachment delegates any missing
|
160
|
+
# methods to Blob, which means it effectively inherits methods from Blob.
|
161
|
+
# This is essentially a hack to make it easier to maintain the
|
162
|
+
# ActiveStorage signatures. We can't include Blob directly because
|
163
|
+
# it's a class, so `include`ing it doesn't work.
|
164
|
+
include ActiveStorage::Blob::Analyzable
|
165
|
+
include ActiveStorage::Blob::Identifiable
|
166
|
+
include ActiveStorage::Blob::Representable
|
167
|
+
end
|
168
|
+
|
169
|
+
class ActiveStorage::Blob < ActiveRecord::Base
|
170
|
+
include ActiveStorage::Blob::Analyzable
|
171
|
+
include ActiveStorage::Blob::Identifiable
|
172
|
+
include ActiveStorage::Blob::Representable
|
173
|
+
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,858 @@
|
|
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(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
|
+
|
548
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
549
|
+
def end_of_day; end
|
550
|
+
|
551
|
+
sig { returns(ActiveSupport::TimeWithZone) }
|
552
|
+
def at_end_of_day; end
|
553
|
+
end
|
554
|
+
|
555
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date
|
556
|
+
# this is not a complete definition!
|
557
|
+
class Date
|
558
|
+
sig { params(options: T::Hash[Symbol, Integer]).returns(Date) }
|
559
|
+
def advance(options); end
|
560
|
+
|
561
|
+
# these are the sigs for Date- in the stdlib
|
562
|
+
# https://github.com/sorbet/sorbet/blob/3910f6cfd9935c9b42e2135e32e15ab8a6e5b9be/rbi/stdlib/date.rbi#L373
|
563
|
+
# note that if more sigs are added to sorbet you should replicate them here
|
564
|
+
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/date.rbi
|
565
|
+
sig {params(arg0: Numeric).returns(T.self_type)}
|
566
|
+
sig {params(arg0: Date).returns(Rational)}
|
567
|
+
# these sigs are added for activesupport users
|
568
|
+
sig {params(arg0: ActiveSupport::Duration).returns(T.self_type)}
|
569
|
+
def -(arg0); end
|
570
|
+
end
|
571
|
+
|
572
|
+
# defines some of the methods at https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/time
|
573
|
+
# this is not a complete definition!
|
574
|
+
class Time
|
575
|
+
sig { returns(Time) }
|
576
|
+
def midnight; end
|
577
|
+
|
578
|
+
sig { returns(Time) }
|
579
|
+
def beginning_of_day; end
|
580
|
+
|
581
|
+
sig { params(options: T::Hash[Symbol, Integer]).returns(Time) }
|
582
|
+
def advance(options); end
|
583
|
+
|
584
|
+
sig { returns(Time) }
|
585
|
+
def at_midnight; end
|
586
|
+
|
587
|
+
sig { returns(Time) }
|
588
|
+
def at_beginning_of_day; end
|
589
|
+
|
590
|
+
sig { returns(Time) }
|
591
|
+
def middle_of_day; end
|
592
|
+
|
593
|
+
sig { returns(Time) }
|
594
|
+
def midday; end
|
595
|
+
|
596
|
+
sig { returns(Time) }
|
597
|
+
def noon; end
|
598
|
+
|
599
|
+
sig { returns(Time) }
|
600
|
+
def at_midday; end
|
601
|
+
|
602
|
+
sig { returns(Time) }
|
603
|
+
def at_noon; end
|
604
|
+
|
605
|
+
sig { returns(Time) }
|
606
|
+
def at_middle_of_day; end
|
607
|
+
|
608
|
+
# https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
|
609
|
+
sig { params(zone: String).returns(T.any(Time, ActiveSupport::TimeWithZone)) }
|
610
|
+
def in_time_zone(zone = ::Time.zone); end
|
611
|
+
|
612
|
+
# these are the sigs for Time- in the stdlib
|
613
|
+
# https://github.com/sorbet/sorbet/blob/c3691753e4ce545e1eb66cbd3e55de67d8879b98/rbi/core/time.rbi#L347
|
614
|
+
# note that if more sigs are added to sorbet you should replicate them here
|
615
|
+
# check sorbet master: https://github.com/sorbet/sorbet/blob/master/rbi/core/time.rbi#L347
|
616
|
+
sig do
|
617
|
+
params(
|
618
|
+
arg0: Time,
|
619
|
+
)
|
620
|
+
.returns(Float)
|
621
|
+
end
|
622
|
+
sig do
|
623
|
+
params(
|
624
|
+
arg0: Numeric,
|
625
|
+
)
|
626
|
+
.returns(Time)
|
627
|
+
end
|
628
|
+
# these sigs are added for activesupport users
|
629
|
+
sig {params(arg0: ActiveSupport::Duration).returns(Time)}
|
630
|
+
def -(arg0); end
|
631
|
+
end
|
632
|
+
|
633
|
+
# defines some of the methods at https://github.com/rails/rails/tree/v6.0.0/activesupport/lib/active_support/core_ext/hash
|
634
|
+
# this is not a complete definition!
|
635
|
+
class Hash
|
636
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
637
|
+
def stringify_keys; end
|
638
|
+
|
639
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
640
|
+
def stringify_keys!; end
|
641
|
+
|
642
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
643
|
+
def deep_stringify_keys; end
|
644
|
+
|
645
|
+
sig { returns(T::Hash[String, T.untyped]) }
|
646
|
+
def deep_stringify_keys!; end
|
647
|
+
|
648
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
649
|
+
def symbolize_keys; end
|
650
|
+
|
651
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
652
|
+
def symbolize_keys!; end
|
653
|
+
|
654
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
655
|
+
def deep_symbolize_keys; end
|
656
|
+
|
657
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
658
|
+
def deep_symbolize_keys!; end
|
659
|
+
|
660
|
+
# in an ideal world, `arg` would be the type of all keys, the 1st `T.untyped` would be
|
661
|
+
# the type of keys your block returns, and the 2nd `T.untyped` would be the type of values
|
662
|
+
# that the hash had.
|
663
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
664
|
+
def deep_transform_keys(&block); end
|
665
|
+
|
666
|
+
sig { params(block: T.proc.params(arg: T.untyped).void).returns(T::Hash[T.untyped, T.untyped]) }
|
667
|
+
def deep_transform_keys!(&block); end
|
668
|
+
|
669
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
670
|
+
def to_options; end
|
671
|
+
end
|
672
|
+
|
673
|
+
class Integer
|
674
|
+
# Returns a Duration instance matching the number of months provided.
|
675
|
+
#
|
676
|
+
# ```ruby
|
677
|
+
# 2.months # => 2 months
|
678
|
+
# ```
|
679
|
+
sig { returns(ActiveSupport::Duration) }
|
680
|
+
def months; end
|
681
|
+
|
682
|
+
sig { returns(ActiveSupport::Duration) }
|
683
|
+
def month; end
|
684
|
+
|
685
|
+
# Returns a Duration instance matching the number of years provided.
|
686
|
+
#
|
687
|
+
# ```ruby
|
688
|
+
# 2.years # => 2 years
|
689
|
+
# ```
|
690
|
+
sig { returns(ActiveSupport::Duration) }
|
691
|
+
def years; end
|
692
|
+
|
693
|
+
sig { returns(ActiveSupport::Duration) }
|
694
|
+
def year; end
|
695
|
+
end
|
696
|
+
|
697
|
+
class Numeric
|
698
|
+
sig { returns(ActiveSupport::Duration) }
|
699
|
+
def second; end
|
700
|
+
|
701
|
+
sig { returns(ActiveSupport::Duration) }
|
702
|
+
def seconds; end
|
703
|
+
|
704
|
+
sig { returns(ActiveSupport::Duration) }
|
705
|
+
def minute; end
|
706
|
+
|
707
|
+
sig { returns(ActiveSupport::Duration) }
|
708
|
+
def minutes; end
|
709
|
+
|
710
|
+
sig { returns(ActiveSupport::Duration) }
|
711
|
+
def hour; end
|
712
|
+
|
713
|
+
sig { returns(ActiveSupport::Duration) }
|
714
|
+
def hours; end
|
715
|
+
|
716
|
+
sig { returns(ActiveSupport::Duration) }
|
717
|
+
def day; end
|
718
|
+
|
719
|
+
sig { returns(ActiveSupport::Duration) }
|
720
|
+
def days; end
|
721
|
+
|
722
|
+
sig { returns(ActiveSupport::Duration) }
|
723
|
+
def week; end
|
724
|
+
|
725
|
+
sig { returns(ActiveSupport::Duration) }
|
726
|
+
def weeks; end
|
727
|
+
|
728
|
+
sig { returns(ActiveSupport::Duration) }
|
729
|
+
def fortnight; end
|
730
|
+
|
731
|
+
sig { returns(ActiveSupport::Duration) }
|
732
|
+
def fortnights; end
|
733
|
+
|
734
|
+
sig { returns(T.self_type) }
|
735
|
+
def in_milliseconds; end
|
736
|
+
end
|
737
|
+
|
738
|
+
module Enumerable
|
739
|
+
# https://github.com/rails/rails/blob/v5.2.3/activesupport/lib/active_support/core_ext/enumerable.rb#L64..L72
|
740
|
+
# the case where a block isn't given isn't handled - that seems like an unlikely case
|
741
|
+
sig do
|
742
|
+
type_parameters(:key).params(
|
743
|
+
block: T.proc.params(o: Enumerable::Elem).returns(T.type_parameter(:key))
|
744
|
+
).returns(
|
745
|
+
T::Hash[T.type_parameter(:key), Enumerable::Elem]
|
746
|
+
)
|
747
|
+
end
|
748
|
+
def index_by(&block); end
|
749
|
+
end
|
750
|
+
|
751
|
+
class ActiveSupport::Duration
|
752
|
+
# Returns the number of seconds that this Duration represents.
|
753
|
+
#
|
754
|
+
# ```ruby
|
755
|
+
# 1.minute.to_i # => 60
|
756
|
+
# 1.hour.to_i # => 3600
|
757
|
+
# 1.day.to_i # => 86400
|
758
|
+
# ```
|
759
|
+
#
|
760
|
+
# Note that this conversion makes some assumptions about the
|
761
|
+
# duration of some periods, e.g. months are always 1/12 of year
|
762
|
+
# and years are 365.2425 days:
|
763
|
+
#
|
764
|
+
# ```ruby
|
765
|
+
# # equivalent to (1.year / 12).to_i
|
766
|
+
# 1.month.to_i # => 2629746
|
767
|
+
#
|
768
|
+
# # equivalent to 365.2425.days.to_i
|
769
|
+
# 1.year.to_i # => 31556952
|
770
|
+
# ```
|
771
|
+
#
|
772
|
+
# In such cases, Ruby's core
|
773
|
+
# [Date](https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html) and
|
774
|
+
# [Time](https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html) should be used for precision
|
775
|
+
# date and time arithmetic.
|
776
|
+
sig { returns(Integer) }
|
777
|
+
def to_i; end
|
778
|
+
|
779
|
+
sig { returns(Float) }
|
780
|
+
def to_f; end
|
781
|
+
|
782
|
+
# Returns the amount of seconds a duration covers as a string.
|
783
|
+
# For more information check to_i method.
|
784
|
+
#
|
785
|
+
# ```ruby
|
786
|
+
# 1.day.to_s # => "86400"
|
787
|
+
# ```
|
788
|
+
sig { returns(String) }
|
789
|
+
def to_s; end
|
790
|
+
|
791
|
+
# Creates a new Duration from string formatted according to ISO 8601 Duration.
|
792
|
+
#
|
793
|
+
# See [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) for more information.
|
794
|
+
# This method allows negative parts to be present in pattern.
|
795
|
+
# If invalid string is provided, it will raise `ActiveSupport::Duration::ISO8601Parser::ParsingError`.
|
796
|
+
sig { params(iso8601duration: String).returns(ActiveSupport::Duration) }
|
797
|
+
def self.parse(iso8601duration); end
|
798
|
+
|
799
|
+
# Creates a new Duration from a seconds value that is converted
|
800
|
+
# to the individual parts:
|
801
|
+
#
|
802
|
+
# ```ruby
|
803
|
+
# ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
|
804
|
+
# ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
|
805
|
+
# ```
|
806
|
+
sig { params(value: Numeric).returns(ActiveSupport::Duration) }
|
807
|
+
def self.build(value); end
|
808
|
+
|
809
|
+
# Returns `true` if `other` is also a Duration instance, which has the
|
810
|
+
# same parts as this one.
|
811
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
812
|
+
def eql?(other); end
|
813
|
+
|
814
|
+
# Compares one Duration with another or a Numeric to this Duration.
|
815
|
+
# Numeric values are treated as seconds.
|
816
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(Integer) }
|
817
|
+
def <=>(other); end
|
818
|
+
|
819
|
+
# Adds another Duration or a Numeric to this Duration. Numeric values
|
820
|
+
# are treated as seconds.
|
821
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
822
|
+
def +(other); end
|
823
|
+
|
824
|
+
# Subtracts another Duration or a Numeric from this Duration. Numeric
|
825
|
+
# values are treated as seconds.
|
826
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
827
|
+
def -(other); end
|
828
|
+
|
829
|
+
# Multiplies this Duration by a Numeric and returns a new Duration.
|
830
|
+
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
831
|
+
def *(other); end
|
832
|
+
|
833
|
+
# Divides this Duration by a Numeric and returns a new Duration.
|
834
|
+
sig { params(other: Numeric).returns(ActiveSupport::Duration) }
|
835
|
+
def /(other); end
|
836
|
+
|
837
|
+
# Returns the modulo of this Duration by another Duration or Numeric.
|
838
|
+
# Numeric values are treated as seconds.
|
839
|
+
sig { params(other: T.any(ActiveSupport::Duration, Numeric)).returns(ActiveSupport::Duration) }
|
840
|
+
def %(other); end
|
841
|
+
|
842
|
+
# Returns `true` if `other` is also a Duration instance with the
|
843
|
+
# same `value`, or if `other == value`.
|
844
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
845
|
+
def ==(other); end
|
846
|
+
|
847
|
+
# Build ISO 8601 Duration string for this duration.
|
848
|
+
# The `precision` parameter can be used to limit seconds' precision of duration.
|
849
|
+
sig { params(precision: T.nilable(Integer)).returns(String) }
|
850
|
+
def iso8601(precision: nil); end
|
851
|
+
end
|
852
|
+
|
853
|
+
module Benchmark
|
854
|
+
extend T::Sig
|
855
|
+
|
856
|
+
sig { params(block: T.proc.void).returns(Float) }
|
857
|
+
def self.ms(&block); end
|
858
|
+
end
|