titleist 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +19 -0
  3. data/.gitignore +1 -2
  4. data/.rubocop.yml +26 -1
  5. data/.ruby-version +1 -1
  6. data/Gemfile +13 -2
  7. data/README.md +95 -25
  8. data/Rakefile +17 -6
  9. data/docs/index.md +7 -0
  10. data/lib/generators/titleist/titleist_generator.rb +3 -0
  11. data/lib/titleist.rb +14 -9
  12. data/lib/titleist/controller.rb +36 -0
  13. data/lib/titleist/engine.rb +10 -4
  14. data/lib/titleist/helper.rb +23 -0
  15. data/lib/titleist/title.rb +52 -89
  16. data/lib/titleist/version.rb +5 -1
  17. data/rbi/sord.rbi +117 -0
  18. data/sorbet/config +2 -0
  19. data/sorbet/rbi/gems/actioncable.rbi +318 -0
  20. data/sorbet/rbi/gems/actionmailbox.rbi +56 -0
  21. data/sorbet/rbi/gems/actionmailer.rbi +446 -0
  22. data/sorbet/rbi/gems/actionpack.rbi +3411 -0
  23. data/sorbet/rbi/gems/actiontext.rbi +79 -0
  24. data/sorbet/rbi/gems/actionview.rbi +1185 -0
  25. data/sorbet/rbi/gems/activejob.rbi +362 -0
  26. data/sorbet/rbi/gems/activemodel.rbi +749 -0
  27. data/sorbet/rbi/gems/activerecord.rbi +5713 -0
  28. data/sorbet/rbi/gems/activestorage.rbi +221 -0
  29. data/sorbet/rbi/gems/activesupport.rbi +2437 -0
  30. data/sorbet/rbi/gems/addressable.rbi +146 -0
  31. data/sorbet/rbi/gems/ast.rbi +47 -0
  32. data/sorbet/rbi/gems/capybara.rbi +1787 -0
  33. data/sorbet/rbi/gems/childprocess.rbi +106 -0
  34. data/sorbet/rbi/gems/codeclimate-test-reporter.rbi +125 -0
  35. data/sorbet/rbi/gems/concurrent-ruby.rbi +1587 -0
  36. data/sorbet/rbi/gems/crass.rbi +92 -0
  37. data/sorbet/rbi/gems/docile.rbi +29 -0
  38. data/sorbet/rbi/gems/erubi.rbi +26 -0
  39. data/sorbet/rbi/gems/globalid.rbi +98 -0
  40. data/sorbet/rbi/gems/i18n.rbi +191 -0
  41. data/sorbet/rbi/gems/jaro_winkler.rbi +14 -0
  42. data/sorbet/rbi/gems/loofah.rbi +129 -0
  43. data/sorbet/rbi/gems/mail.rbi +1582 -0
  44. data/sorbet/rbi/gems/marcel.rbi +12 -0
  45. data/sorbet/rbi/gems/method_source.rbi +63 -0
  46. data/sorbet/rbi/gems/mini_mime.rbi +51 -0
  47. data/sorbet/rbi/gems/minitest.rbi +419 -0
  48. data/sorbet/rbi/gems/mocha.rbi +794 -0
  49. data/sorbet/rbi/gems/nio4r.rbi +67 -0
  50. data/sorbet/rbi/gems/nokogiri.rbi +1010 -0
  51. data/sorbet/rbi/gems/parallel.rbi +81 -0
  52. data/sorbet/rbi/gems/parser.rbi +920 -0
  53. data/sorbet/rbi/gems/public_suffix.rbi +103 -0
  54. data/sorbet/rbi/gems/puma.rbi +586 -0
  55. data/sorbet/rbi/gems/rack-test.rbi +161 -0
  56. data/sorbet/rbi/gems/rack.rbi +634 -0
  57. data/sorbet/rbi/gems/rails-dom-testing.rbi +67 -0
  58. data/sorbet/rbi/gems/rails-html-sanitizer.rbi +91 -0
  59. data/sorbet/rbi/gems/railties.rbi +834 -0
  60. data/sorbet/rbi/gems/rainbow.rbi +117 -0
  61. data/sorbet/rbi/gems/rake.rbi +269 -0
  62. data/sorbet/rbi/gems/regexp_parser.rbi +912 -0
  63. data/sorbet/rbi/gems/rubocop.rbi +7232 -0
  64. data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
  65. data/sorbet/rbi/gems/rubyzip.rbi +546 -0
  66. data/sorbet/rbi/gems/selenium-webdriver.rbi +1450 -0
  67. data/sorbet/rbi/gems/simplecov-html.rbi +30 -0
  68. data/sorbet/rbi/gems/simplecov.rbi +189 -0
  69. data/sorbet/rbi/gems/site_ruby.rbi +265 -0
  70. data/sorbet/rbi/gems/sprockets-rails.rbi +105 -0
  71. data/sorbet/rbi/gems/sprockets.rbi +753 -0
  72. data/sorbet/rbi/gems/sqlite3.rbi +353 -0
  73. data/sorbet/rbi/gems/thor.rbi +579 -0
  74. data/sorbet/rbi/gems/thread_safe.rbi +81 -0
  75. data/sorbet/rbi/gems/tzinfo.rbi +405 -0
  76. data/sorbet/rbi/gems/unicode-display_width.rbi +16 -0
  77. data/sorbet/rbi/gems/webdrivers.rbi +155 -0
  78. data/sorbet/rbi/gems/xpath.rbi +158 -0
  79. data/sorbet/rbi/gems/yard.rbi +1159 -0
  80. data/sorbet/rbi/hidden-definitions/errors.txt +14957 -0
  81. data/sorbet/rbi/hidden-definitions/hidden.rbi +24898 -0
  82. data/sorbet/rbi/sorbet-typed/lib/actionmailer/all/actionmailer.rbi +13 -0
  83. data/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +938 -0
  84. data/sorbet/rbi/sorbet-typed/lib/actionview/all/actionview.rbi +314 -0
  85. data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +425 -0
  86. data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5.2/activerecord.rbi +17 -0
  87. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1425 -0
  88. data/sorbet/rbi/sorbet-typed/lib/activerecord/~>6.0.0/activerecord.rbi +475 -0
  89. data/sorbet/rbi/sorbet-typed/lib/activestorage/>=6.0.0/activestorage.rbi +19 -0
  90. data/sorbet/rbi/sorbet-typed/lib/activestorage/all/activestorage.rbi +173 -0
  91. data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6.0.0.rc1/activesupport.rbi +23 -0
  92. data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +858 -0
  93. data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +8684 -0
  94. data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
  95. data/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +25 -0
  96. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +254 -0
  97. data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +4222 -0
  98. data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +111 -0
  99. data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +543 -0
  100. data/sorbet/rbi/todo.rbi +20 -0
  101. data/titleist.gemspec +3 -14
  102. metadata +96 -155
  103. data/.travis.yml +0 -45
  104. data/app/controllers/.keep +0 -0
  105. data/app/helpers/.keep +0 -0
  106. data/app/helpers/titleist_helper.rb +0 -47
  107. data/app/mailers/.keep +0 -0
  108. data/app/models/.keep +0 -0
  109. data/app/views/.keep +0 -0
@@ -0,0 +1,314 @@
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/actionview/all/actionview.rbi
7
+ #
8
+ # typed: strong
9
+
10
+ module ActionView
11
+ class ActionViewError < StandardError; end
12
+ class EncodingError < StandardError; end
13
+ class WrongEncodingError < EncodingError; end
14
+
15
+ class MissingTemplate < ActionViewError
16
+ sig { returns(String) }
17
+ def path; end
18
+ end
19
+
20
+ class Template
21
+ class Error < ActionViewError; end
22
+ end
23
+
24
+ TemplateError = T.type_alias {Template::Error}
25
+
26
+ class SyntaxErrorInTemplate < Template::Error; end
27
+ end
28
+
29
+ # Provides a set of methods for making links and getting URLs that
30
+ # depend on the routing subsystem (see ActionDispatch::Routing).
31
+ # This allows you to use the same format for links in views
32
+ # and controllers.
33
+ module ActionView::Helpers::UrlHelper
34
+ # Creates an anchor element of the given `name` using a URL created by the set of `options`.
35
+ # See the valid options in the documentation for `url_for`. It's also possible to
36
+ # pass a String instead of an options hash, which generates an anchor element that uses the
37
+ # value of the String as the href for the link. Using a `:back` Symbol instead
38
+ # of an options hash will generate a link to the referrer (a JavaScript back link
39
+ # will be used in place of a referrer if none exists). If `nil` is passed as the name
40
+ # the value of the link itself will become the name.
41
+ #
42
+ # #### Signatures
43
+ #
44
+ # ```ruby
45
+ # link_to(body, url, html_options = {})
46
+ # # url is a String; you can use URL helpers like
47
+ # # posts_path
48
+ #
49
+ # link_to(body, url_options = {}, html_options = {})
50
+ # # url_options, except :method, is passed to url_for
51
+ #
52
+ # link_to(options = {}, html_options = {}) do
53
+ # # name
54
+ # end
55
+ #
56
+ # link_to(url, html_options = {}) do
57
+ # # name
58
+ # end
59
+ # ```
60
+ #
61
+ # #### Options
62
+ # * `:data` - This option can be used to add custom data attributes.
63
+ # * `method: symbol of HTTP verb` - This modifier will dynamically
64
+ # create an HTML form and immediately submit the form for processing using
65
+ # the HTTP verb specified. Useful for having links perform a POST operation
66
+ # in dangerous actions like deleting a record (which search bots can follow
67
+ # while spidering your site). Supported verbs are `:post`, `:delete`, `:patch`, and `:put`.
68
+ # Note that if the user has JavaScript disabled, the request will fall back
69
+ # to using GET. If `href: '#'` is used and the user has JavaScript
70
+ # disabled clicking the link will have no effect. If you are relying on the
71
+ # POST behavior, you should check for it in your controller's action by using
72
+ # the request object's methods for `post?`, `delete?`, `patch?`, or `put?`.
73
+ # * `remote: true` - This will allow the unobtrusive JavaScript
74
+ # driver to make an Ajax request to the URL in question instead of following
75
+ # the link. The drivers each provide mechanisms for listening for the
76
+ # completion of the Ajax request and performing JavaScript operations once
77
+ # they're complete
78
+ #
79
+ # #### Data attributes
80
+ #
81
+ # * `confirm: 'question?'` - This will allow the unobtrusive JavaScript
82
+ # driver to prompt with the question specified (in this case, the
83
+ # resulting text would be `question?`. If the user accepts, the
84
+ # link is processed normally, otherwise no action is taken.
85
+ # * `:disable_with` - Value of this parameter will be used as the
86
+ # name for a disabled version of the link. This feature is provided by
87
+ # the unobtrusive JavaScript driver.
88
+ #
89
+ # #### Examples
90
+ # Because it relies on `url_for`, `link_to` supports both older-style controller/action/id arguments
91
+ # and newer RESTful routes. Current Rails style favors RESTful routes whenever possible, so base
92
+ # your application on resources and use
93
+ #
94
+ # ```ruby
95
+ # link_to "Profile", profile_path(@profile)
96
+ # # => <a href="/profiles/1">Profile</a>
97
+ # ```
98
+ #
99
+ # or the even pithier
100
+ #
101
+ # ```ruby
102
+ # link_to "Profile", @profile
103
+ # # => <a href="/profiles/1">Profile</a>
104
+ # ```
105
+ #
106
+ # in place of the older more verbose, non-resource-oriented
107
+ #
108
+ # ```ruby
109
+ # link_to "Profile", controller: "profiles", action: "show", id: @profile
110
+ # # => <a href="/profiles/show/1">Profile</a>
111
+ # ```
112
+ #
113
+ # Similarly,
114
+ #
115
+ # ```ruby
116
+ # link_to "Profiles", profiles_path
117
+ # # => <a href="/profiles">Profiles</a>
118
+ # ```
119
+ #
120
+ # is better than
121
+ #
122
+ # ```ruby
123
+ # link_to "Profiles", controller: "profiles"
124
+ # # => <a href="/profiles">Profiles</a>
125
+ # ```
126
+ #
127
+ # When name is `nil` the href is presented instead
128
+ #
129
+ # ```ruby
130
+ # link_to nil, "http://example.com"
131
+ # # => <a href="http://www.example.com">http://www.example.com</a>
132
+ # ```
133
+ #
134
+ # You can use a block as well if your link target is hard to fit into the name parameter. ERB example:
135
+ #
136
+ # ```html
137
+ # <%= link_to(@profile) do %>
138
+ # <strong><%= @profile.name %></strong> -- <span>Check it out!</span>
139
+ # <% end %>
140
+ # # => <a href="/profiles/1">
141
+ # <strong>David</strong> -- <span>Check it out!</span>
142
+ # </a>
143
+ # ```
144
+ #
145
+ # Classes and ids for CSS are easy to produce:
146
+ #
147
+ # ```ruby
148
+ # link_to "Articles", articles_path, id: "news", class: "article"
149
+ # # => <a href="/articles" class="article" id="news">Articles</a>
150
+ # ```
151
+ #
152
+ # Be careful when using the older argument style, as an extra literal hash is needed:
153
+ #
154
+ # ```ruby
155
+ # link_to "Articles", { controller: "articles" }, id: "news", class: "article"
156
+ # # => <a href="/articles" class="article" id="news">Articles</a>
157
+ # ```
158
+ #
159
+ # Leaving the hash off gives the wrong link:
160
+ #
161
+ # ```ruby
162
+ # link_to "WRONG!", controller: "articles", id: "news", class: "article"
163
+ # # => <a href="/articles/index/news?class=article">WRONG!</a>
164
+ # ```
165
+ #
166
+ # `link_to` can also produce links with anchors or query strings:
167
+ #
168
+ # ```ruby
169
+ # link_to "Comment wall", profile_path(@profile, anchor: "wall")
170
+ # # => <a href="/profiles/1#wall">Comment wall</a>
171
+ #
172
+ # link_to "Ruby on Rails search", controller: "searches", query: "ruby on rails"
173
+ # # => <a href="/searches?query=ruby+on+rails">Ruby on Rails search</a>
174
+ #
175
+ # link_to "Nonsense search", searches_path(foo: "bar", baz: "quux")
176
+ # # => <a href="/searches?foo=bar&amp;baz=quux">Nonsense search</a>
177
+ # ```
178
+ #
179
+ # The only option specific to `link_to` (`:method`) is used as follows:
180
+ #
181
+ # ```ruby
182
+ # link_to("Destroy", "http://www.example.com", method: :delete)
183
+ # # => <a href='http://www.example.com' rel="nofollow" data-method="delete">Destroy</a>
184
+ # ```
185
+ #
186
+ # You can also use custom data attributes using the `:data` option:
187
+ #
188
+ # ```ruby
189
+ # link_to "Visit Other Site", "http://www.rubyonrails.org/", data: { confirm: "Are you sure?" }
190
+ # # => <a href="http://www.rubyonrails.org/" data-confirm="Are you sure?">Visit Other Site</a>
191
+ # ```
192
+ #
193
+ # Also you can set any link attributes such as `target`, `rel`, `type`:
194
+ #
195
+ # ```ruby
196
+ # link_to "External link", "http://www.rubyonrails.org/", target: "_blank", rel: "nofollow"
197
+ # # => <a href="http://www.rubyonrails.org/" target="_blank" rel="nofollow">External link</a>
198
+ # ```
199
+ sig do
200
+ params(
201
+ name: String,
202
+ options: T.untyped,
203
+ html_options: T.untyped,
204
+ block: T.untyped
205
+ ).returns(ActiveSupport::SafeBuffer)
206
+ end
207
+ def link_to(name = nil, options = nil, html_options = nil, &block); end
208
+
209
+ # Creates a link tag of the given `name` using a URL created by the set of
210
+ # `options` if `condition` is true, otherwise only the name is
211
+ # returned. To specialize the default behavior, you can pass a block that
212
+ # accepts the name or the full argument list for `link_to_unless` (see the examples
213
+ # in `link_to_unless`).
214
+ #
215
+ # #### Examples
216
+ # ```ruby
217
+ # <%= link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) %>
218
+ # # If the user isn't logged in...
219
+ # # => <a href="/sessions/new/">Login</a>
220
+ # ```
221
+ #
222
+ # ```ruby
223
+ # <%=
224
+ # link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) do
225
+ # link_to(@current_user.login, { controller: "accounts", action: "show", id: @current_user })
226
+ # end
227
+ # %>
228
+ # # If the user isn't logged in...
229
+ # # => <a href="/sessions/new/">Login</a>
230
+ # # If they are logged in...
231
+ # # => <a href="/accounts/show/3">my_username</a>
232
+ # ```
233
+ sig do
234
+ params(
235
+ condition: T.untyped,
236
+ name: String,
237
+ options: T.untyped,
238
+ html_options: T.untyped,
239
+ block: T.untyped
240
+ ).returns(T.untyped)
241
+ end
242
+ def link_to_if(condition, name, options = {}, html_options = {}, &block); end
243
+
244
+ # True if the current request URI was generated by the given `options`.
245
+ #
246
+ # #### Examples
247
+ # Let's say we're in the `http://www.example.com/shop/checkout?order=desc&page=1` action.
248
+ #
249
+ # ```ruby
250
+ # current_page?(action: 'process')
251
+ # # => false
252
+ #
253
+ # current_page?(action: 'checkout')
254
+ # # => true
255
+ #
256
+ # current_page?(controller: 'library', action: 'checkout')
257
+ # # => false
258
+ #
259
+ # current_page?(controller: 'shop', action: 'checkout')
260
+ # # => true
261
+ #
262
+ # current_page?(controller: 'shop', action: 'checkout', order: 'asc')
263
+ # # => false
264
+ #
265
+ # current_page?(controller: 'shop', action: 'checkout', order: 'desc', page: '1')
266
+ # # => true
267
+ #
268
+ # current_page?(controller: 'shop', action: 'checkout', order: 'desc', page: '2')
269
+ # # => false
270
+ #
271
+ # current_page?('http://www.example.com/shop/checkout')
272
+ # # => true
273
+ #
274
+ # current_page?('http://www.example.com/shop/checkout', check_parameters: true)
275
+ # # => false
276
+ #
277
+ # current_page?('/shop/checkout')
278
+ # # => true
279
+ #
280
+ # current_page?('http://www.example.com/shop/checkout?order=desc&page=1')
281
+ # # => true
282
+ # ```
283
+ #
284
+ # Let's say we're in the `http://www.example.com/products` action with method POST in case of invalid product.
285
+ #
286
+ # ```ruby
287
+ # current_page?(controller: 'product', action: 'index')
288
+ # # => false
289
+ # ```
290
+ #
291
+ # We can also pass in the symbol arguments instead of strings.
292
+ sig { params(options: T.untyped, check_parameters: T::Boolean).returns(T::Boolean) }
293
+ def current_page?(options, check_parameters: false); end
294
+ end
295
+
296
+ module ActionView::Layouts
297
+ extend T::Helpers
298
+
299
+ module ClassMethods; end
300
+
301
+ mixes_in_class_methods(ActionView::Layouts::ClassMethods)
302
+ end
303
+
304
+ module ActionView::Rendering
305
+ extend T::Helpers
306
+
307
+ mixes_in_class_methods(ActionView::Rendering::ClassMethods)
308
+ end
309
+
310
+ module ActionView::ViewPaths
311
+ extend T::Helpers
312
+
313
+ mixes_in_class_methods(ActionView::ViewPaths::ClassMethods)
314
+ end
@@ -0,0 +1,425 @@
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: false
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
+ mixes_in_class_methods(ClassMethods)
27
+
28
+ module ClassMethods
29
+ # https://github.com/rails/rails/blob/v5.2.3/activemodel/lib/active_model/validations.rb#L136-L154
30
+ sig do
31
+ params(
32
+ names: T.any(Symbol, String),
33
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
34
+ on: T.any(Symbol, String),
35
+ prepend: T::Boolean,
36
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
37
+ ).void
38
+ end
39
+ def validate(
40
+ *names,
41
+ if: nil,
42
+ on: nil,
43
+ prepend: false,
44
+ unless: nil
45
+ ); end
46
+
47
+ # https://github.com/rails/rails/blob/v5.2.3/activemodel/lib/active_model/validations/validates.rb#L75-L105
48
+ sig do
49
+ params(
50
+ names: T.any(Symbol, String), # a splat of at least one attribute name
51
+ absence: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
52
+ acceptance: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
53
+ allow_blank: T::Boolean,
54
+ allow_nil: T::Boolean,
55
+ confirmation: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
56
+ # `exclusion` and `inclusion` are tricky to type without better support
57
+ # for overloading and shapes. Value can be anything that responds to
58
+ # `include?` (e.g. (1..3)), or a hash having an `in` or `within` key,
59
+ # like { in: [1, 2, 3], ... }
60
+ exclusion: T::Enumerable[T.untyped],
61
+ # `format` hash must additionally contain either :with or :without keys.
62
+ # Alternatively, it can be a Regexp.
63
+ format: T.any(T::Hash[T.untyped, T.untyped], Regexp),
64
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
65
+ # `exclusion` and `inclusion` are tricky to type without better support
66
+ # for overloading and shapes. Value can be anything that responds to
67
+ # `include?` (e.g. (1..3)), or a hash having an `in` or `within` key,
68
+ # like { in: [1, 2, 3], ... }
69
+ inclusion: T::Enumerable[T.untyped],
70
+ # if Hash, must contain :in, :within, :maximum, :minimum, or :is keys
71
+ length: T.any(T::Range[T.untyped], T::Hash[T.untyped, T.untyped]),
72
+ numericality: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
73
+ on: T.any(Symbol, String, T::Array[T.any(Symbol, String)]),
74
+ presence: T::Boolean,
75
+ size: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
76
+ strict: T::Boolean,
77
+ uniqueness: T.any(T::Boolean, T::Hash[T.untyped, T.untyped]),
78
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
79
+ ).void
80
+ end
81
+ def validates(
82
+ *names,
83
+ absence: false,
84
+ acceptance: {},
85
+ allow_blank: false,
86
+ allow_nil: false,
87
+ confirmation: false,
88
+ exclusion: [],
89
+ format: {},
90
+ if: nil,
91
+ inclusion: [],
92
+ length: {},
93
+ numericality: false,
94
+ on: :_,
95
+ presence: false,
96
+ size: false,
97
+ strict: false,
98
+ uniqueness: false,
99
+ unless: :_
100
+ )
101
+ end
102
+ end
103
+ end
104
+
105
+ class ActiveModel::Type::Boolean
106
+ sig { params(arg0: T.untyped).returns(T.nilable(T::Boolean))}
107
+ def cast(arg0); end
108
+ end
109
+
110
+ module ActiveModel::Validations::HelperMethods
111
+ sig do
112
+ params(
113
+ attr_names: T.any(String, Symbol),
114
+ message: String,
115
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
116
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
117
+ on: T.any(Symbol, String),
118
+ allow_nil: T::Boolean,
119
+ allow_blank: T::Boolean,
120
+ strict: T::Boolean
121
+ ).void
122
+ end
123
+ def validates_absence_of(
124
+ *attr_names,
125
+ message: 'must be blank',
126
+ if: nil,
127
+ unless: :_,
128
+ on: :_,
129
+ allow_nil: false,
130
+ allow_blank: false,
131
+ strict: false
132
+ ); end
133
+
134
+ sig do
135
+ params(
136
+ attr_names: T.any(String, Symbol),
137
+ message: String,
138
+ accept: T.untyped,
139
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
140
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
141
+ on: T.any(Symbol, String),
142
+ allow_nil: T::Boolean,
143
+ allow_blank: T::Boolean,
144
+ strict: T::Boolean
145
+ ).void
146
+ end
147
+ def validates_acceptance_of(
148
+ *attr_names,
149
+ message: 'must be accepted',
150
+ accept: ['1', true],
151
+ if: nil,
152
+ unless: :_,
153
+ on: :_,
154
+ allow_nil: false,
155
+ allow_blank: false,
156
+ strict: false
157
+ ); end
158
+
159
+ sig do
160
+ params(
161
+ attr_names: T.any(String, Symbol),
162
+ message: String,
163
+ case_sensitive: T::Boolean,
164
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
165
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
166
+ on: T.any(Symbol, String),
167
+ allow_nil: T::Boolean,
168
+ allow_blank: T::Boolean,
169
+ strict: T::Boolean
170
+ ).void
171
+ end
172
+ def validates_confirmation_of(
173
+ *attr_names,
174
+ message: "doesn't match %{translated_attribute_name}",
175
+ case_sensitive: true,
176
+ if: nil,
177
+ unless: :_,
178
+ on: :_,
179
+ allow_nil: false,
180
+ allow_blank: false,
181
+ strict: false
182
+ ); end
183
+
184
+ # A type alias for the in/within parameters on the
185
+ # validates_(inclusion/exclusion)_of methods.
186
+ InWithinType = T.type_alias do
187
+ T.nilable(
188
+ T.any(
189
+ Symbol,
190
+ String,
191
+ T::Array[T.any(String, Symbol)],
192
+ T::Range[Integer],
193
+ T::Array[T::Boolean],
194
+ T.proc.params(arg0: T.untyped).returns(T::Boolean)
195
+ )
196
+ )
197
+ end
198
+ sig do
199
+ params(
200
+ attr_names: T.any(String, Symbol),
201
+ message: String,
202
+ in: InWithinType,
203
+ within: InWithinType,
204
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
205
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
206
+ on: T.any(Symbol, String),
207
+ allow_nil: T::Boolean,
208
+ allow_blank: T::Boolean,
209
+ strict: T::Boolean
210
+ ).void
211
+ end
212
+ def validates_exclusion_of(
213
+ *attr_names,
214
+ message: 'is reserved',
215
+ in: nil,
216
+ within: nil,
217
+ if: nil,
218
+ unless: :_,
219
+ on: :_,
220
+ allow_nil: false,
221
+ allow_blank: false,
222
+ strict: false
223
+ ); end
224
+
225
+ sig do
226
+ params(
227
+ attr_names: T.any(String, Symbol),
228
+ message: String,
229
+ with: T.untyped,
230
+ without: T.untyped,
231
+ multiline: T.untyped,
232
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
233
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
234
+ on: T.any(Symbol, String),
235
+ allow_nil: T::Boolean,
236
+ allow_blank: T::Boolean,
237
+ strict: T::Boolean
238
+ ).void
239
+ end
240
+ def validates_format_of(
241
+ *attr_names,
242
+ message: 'is invalid',
243
+ with: nil,
244
+ without: nil,
245
+ multiline: nil,
246
+ if: nil,
247
+ unless: :_,
248
+ on: :_,
249
+ allow_nil: false,
250
+ allow_blank: false,
251
+ strict: false
252
+ ); end
253
+
254
+ sig do
255
+ params(
256
+ attr_names: T.any(String, Symbol),
257
+ message: String,
258
+ in: InWithinType,
259
+ within: InWithinType,
260
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
261
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
262
+ on: T.any(Symbol, String),
263
+ allow_nil: T::Boolean,
264
+ allow_blank: T::Boolean,
265
+ strict: T::Boolean
266
+ ).void
267
+ end
268
+ def validates_inclusion_of(
269
+ *attr_names,
270
+ message: 'is not included in the list',
271
+ in: nil,
272
+ within: nil,
273
+ if: nil,
274
+ unless: :_,
275
+ on: :_,
276
+ allow_nil: false,
277
+ allow_blank: false,
278
+ strict: false
279
+ ); end
280
+
281
+ sig do
282
+ params(
283
+ attr_names: T.any(String, Symbol),
284
+ message: T.nilable(String),
285
+ minimum: T.nilable(Integer),
286
+ maximum: T.nilable(Integer),
287
+ is: T.nilable(Integer),
288
+ within: T.nilable(T::Range[Integer]),
289
+ in: T.nilable(T::Range[Integer]),
290
+ too_long: String,
291
+ too_short: String,
292
+ wrong_length: String,
293
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
294
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
295
+ on: T.any(Symbol, String),
296
+ allow_nil: T::Boolean,
297
+ allow_blank: T::Boolean,
298
+ strict: T::Boolean
299
+ ).void
300
+ end
301
+ def validates_length_of(
302
+ *attr_names,
303
+ message: nil,
304
+ minimum: nil,
305
+ maximum: nil,
306
+ is: nil,
307
+ within: nil,
308
+ in: nil,
309
+ too_long: 'is too long (maximum is %{count} characters)',
310
+ too_short: 'is too short (minimum is %{count} characters)',
311
+ wrong_length: 'is the wrong length (should be %{count} characters)',
312
+ if: nil,
313
+ unless: :_,
314
+ on: :_,
315
+ allow_nil: false,
316
+ allow_blank: false,
317
+ strict: false
318
+ ); end
319
+
320
+ # validates_size_of is an alias of validates_length_of
321
+ sig do
322
+ params(
323
+ attr_names: T.any(String, Symbol),
324
+ message: T.nilable(String),
325
+ minimum: T.nilable(Integer),
326
+ maximum: T.nilable(Integer),
327
+ is: T.nilable(Integer),
328
+ within: T.nilable(T::Range[Integer]),
329
+ in: T.nilable(T::Range[Integer]),
330
+ too_long: String,
331
+ too_short: String,
332
+ wrong_length: String,
333
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
334
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
335
+ on: T.any(Symbol, String),
336
+ allow_nil: T::Boolean,
337
+ allow_blank: T::Boolean,
338
+ strict: T::Boolean
339
+ ).void
340
+ end
341
+ def validates_size_of(
342
+ *attr_names,
343
+ message: nil,
344
+ minimum: nil,
345
+ maximum: nil,
346
+ is: nil,
347
+ within: nil,
348
+ in: nil,
349
+ too_long: 'is too long (maximum is %{count} characters)',
350
+ too_short: 'is too short (minimum is %{count} characters)',
351
+ wrong_length: 'is the wrong length (should be %{count} characters)',
352
+ if: nil,
353
+ unless: :_,
354
+ on: :_,
355
+ allow_nil: false,
356
+ allow_blank: false,
357
+ strict: false
358
+ ); end
359
+
360
+ # Create a type alias so we don't have to repeat this long type signature 6 times.
361
+ NumberComparatorType = T.type_alias {T.nilable(T.any(Integer, Float, T.proc.params(arg0: T.untyped).returns(T::Boolean), Symbol))}
362
+ sig do
363
+ params(
364
+ attr_names: T.any(String, Symbol),
365
+ message: String,
366
+ only_integer: T::Boolean,
367
+ greater_than: NumberComparatorType,
368
+ greater_than_or_equal_to: NumberComparatorType,
369
+ equal_to: NumberComparatorType,
370
+ less_than: NumberComparatorType,
371
+ less_than_or_equal_to: NumberComparatorType,
372
+ other_than: NumberComparatorType,
373
+ odd: T::Boolean,
374
+ even: T::Boolean,
375
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
376
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
377
+ on: T.any(Symbol, String),
378
+ allow_nil: T::Boolean,
379
+ allow_blank: T::Boolean,
380
+ strict: T::Boolean
381
+ ).void
382
+ end
383
+ def validates_numericality_of(
384
+ *attr_names,
385
+ message: 'is not a number',
386
+ only_integer: false,
387
+ greater_than: nil,
388
+ greater_than_or_equal_to: nil,
389
+ equal_to: nil,
390
+ less_than: nil,
391
+ less_than_or_equal_to: nil,
392
+ other_than: nil,
393
+ odd: false,
394
+ even: false,
395
+ if: nil,
396
+ unless: :_,
397
+ on: :_,
398
+ allow_nil: false,
399
+ allow_blank: false,
400
+ strict: false
401
+ ); end
402
+
403
+ sig do
404
+ params(
405
+ attr_names: T.any(String, Symbol),
406
+ message: String,
407
+ if: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
408
+ unless: T.any(Symbol, String, T.proc.params(arg0: T.untyped).returns(T::Boolean)),
409
+ on: T.any(Symbol, String),
410
+ allow_nil: T::Boolean,
411
+ allow_blank: T::Boolean,
412
+ strict: T::Boolean
413
+ ).void
414
+ end
415
+ def validates_presence_of(
416
+ *attr_names,
417
+ message: "can't be blank",
418
+ if: nil,
419
+ unless: :_,
420
+ on: :_,
421
+ allow_nil: false,
422
+ allow_blank: false,
423
+ strict: false
424
+ ); end
425
+ end