orthoses-rails 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/examples/rails/{gemfiles/Gemfile_6_0 → Gemfile} +4 -4
  3. data/examples/rails/{gemfiles/Gemfile_7_0.lock → Gemfile.lock} +80 -74
  4. data/examples/rails/Rakefile +53 -39
  5. data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +4 -0
  6. data/examples/rails/known_sig/activemodel/7.0/active_model/serialization.rbs +4 -0
  7. data/examples/rails/known_sig/activemodel/7.0/active_model/validations.rbs +4 -0
  8. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +49 -0
  9. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +45 -0
  10. data/examples/rails/known_sig/activerecord/6.0/active_record/result.rbs +5 -0
  11. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +49 -0
  12. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +45 -0
  13. data/examples/rails/known_sig/activerecord/6.1/active_record/result.rbs +5 -0
  14. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +49 -0
  15. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +45 -0
  16. data/examples/rails/known_sig/activerecord/7.0/active_record/encryption/context.rbs +9 -0
  17. data/examples/rails/known_sig/activerecord/7.0/active_record/result.rbs +5 -0
  18. data/examples/rails/known_sig/activesupport/7.0/active_support/callbacks/callback_chain.rbs +9 -0
  19. data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +4 -0
  20. data/examples/rails/known_sig/activesupport/7.0/active_support/hash_with_indifferent_access.rbs +6 -0
  21. data/examples/rails/known_sig/activesupport/7.0/active_support/multibyte/chars.rbs +7 -0
  22. data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +5 -0
  23. data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +3 -0
  24. data/examples/rails/known_sig/activesupport/7.0/date.rbs +6 -0
  25. data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +4 -0
  26. data/examples/rails/known_sig/activesupport/7.0/hash_with_indifferent_access.rbs +2 -0
  27. data/examples/rails/known_sig/activesupport/7.0/integer.rbs +9 -0
  28. data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +15 -0
  29. data/examples/rails/known_sig/activesupport/7.0/string.rbs +4 -0
  30. data/examples/rails/known_sig/activesupport/7.0/time.rbs +76 -0
  31. data/examples/rails/tasks/action_pack.rake +141 -0
  32. data/examples/rails/tasks/action_view.rake +77 -0
  33. data/examples/rails/tasks/active_job.rake +5 -1
  34. data/examples/rails/tasks/active_model.rake +1 -1
  35. data/examples/rails/tasks/active_record.rake +7 -2
  36. data/examples/rails/tasks/active_storage.rake +1 -1
  37. data/examples/rails/tasks/active_support.rake +7 -0
  38. data/examples/rails/tasks/railties.rake +37 -0
  39. data/lib/orthoses/active_model/has_secure_password.rb +2 -10
  40. data/lib/orthoses/active_record/delegated_type.rb +2 -8
  41. data/lib/orthoses/active_record/enum.rb +2 -2
  42. data/lib/orthoses/active_record/generated_attribute_methods.rb +1 -0
  43. data/lib/orthoses/active_record/scope.rb +2 -2
  44. data/lib/orthoses/active_support/class_attribute.rb +3 -10
  45. data/lib/orthoses/active_support/configurable.rb +3 -2
  46. data/lib/orthoses/active_support/delegation.rb +6 -14
  47. data/lib/orthoses/active_support/mattr_accessor.rb +4 -12
  48. data/lib/orthoses/active_support.rb +0 -15
  49. data/lib/orthoses/rails/version.rb +1 -1
  50. data/lib/orthoses/rails.rb +1 -0
  51. data/lib/orthoses/railties/mixin.rb +107 -0
  52. data/lib/orthoses/railties.rb +3 -0
  53. data/orthoses-rails.gemspec +1 -1
  54. metadata +38 -11
  55. data/examples/rails/gemfiles/Gemfile_6_0.lock +0 -172
  56. data/examples/rails/gemfiles/Gemfile_6_1 +0 -15
  57. data/examples/rails/gemfiles/Gemfile_6_1.lock +0 -173
  58. data/examples/rails/gemfiles/Gemfile_7_0 +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46bcd93481527f23bfe512d336313721f7cf17fe67bb124e51e016f59cff14c2
4
- data.tar.gz: 7a783be26aeeb877069e4c0e431765e274bb07dd25438669ca8dbb58c6417405
3
+ metadata.gz: 721183c8c3c14666265aa24ecfe51ba9703afe1ed99bf5e320b6c57c2e995722
4
+ data.tar.gz: deabd621c4483c341b687dc5562c72aa52a49c4b983544244dc9e2b736cd056d
5
5
  SHA512:
6
- metadata.gz: ef3237aa508e90177b76dd160456404cf37dfcd1907b18ad299b1cd2f95e1abd4971762de5a0679850943b220348b7f7528689eef31be84651a30cbb29eb2601
7
- data.tar.gz: 353ee63dc4a5bd7fa82fa59f571766b842690c09bd98d14e4f3f1defbb77ec14870f361149b3ac0ab6b46cad9b933f02ecaf8190a5824a4e3739b088ba14bea4
6
+ metadata.gz: ed8956fbfd018c4dbd650c1c20c9d46172c1cabafd286de074dbcda62d5f898125d66b12a4b461097eb6134dd3dd9dac9546157a794152064201d12261bc3365
7
+ data.tar.gz: c4154bd4a83864ebf2f8a13fa7cffd4bb721374f9d05674a234565efc3676ac0a837aef866233ef9f256351b70022cc60bd07f199f588d57e6bba50f0edca819
@@ -1,12 +1,12 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- ruby "~> 3.1.0"
3
+ ruby ">= 3.1.0"
4
4
 
5
- gemspec path: '../../../'
5
+ gemspec path: '../../'
6
6
 
7
- gem "rails", ">= 6.0", "< 6.1"
7
+ gem "rails", path: "_src"
8
8
  gem "sqlite3"
9
- # gem "orthoses", path: "../../../../orthoses"
9
+ # gem "orthoses", path: "../../../orthoses"
10
10
 
11
11
  if RUBY_VERSION >= "3.1"
12
12
  gem "net-smtp", require: false
@@ -1,85 +1,110 @@
1
1
  PATH
2
- remote: ../../..
2
+ remote: ../..
3
3
  specs:
4
- orthoses-rails (0.4.0)
4
+ orthoses-rails (0.6.0)
5
5
  orthoses (>= 0.10)
6
6
 
7
- GEM
8
- remote: https://rubygems.org/
7
+ PATH
8
+ remote: _src
9
9
  specs:
10
- actioncable (7.0.3)
11
- actionpack (= 7.0.3)
12
- activesupport (= 7.0.3)
10
+ actioncable (7.0.3.1)
11
+ actionpack (= 7.0.3.1)
12
+ activesupport (= 7.0.3.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.3)
16
- actionpack (= 7.0.3)
17
- activejob (= 7.0.3)
18
- activerecord (= 7.0.3)
19
- activestorage (= 7.0.3)
20
- activesupport (= 7.0.3)
15
+ actionmailbox (7.0.3.1)
16
+ actionpack (= 7.0.3.1)
17
+ activejob (= 7.0.3.1)
18
+ activerecord (= 7.0.3.1)
19
+ activestorage (= 7.0.3.1)
20
+ activesupport (= 7.0.3.1)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.3)
26
- actionpack (= 7.0.3)
27
- actionview (= 7.0.3)
28
- activejob (= 7.0.3)
29
- activesupport (= 7.0.3)
25
+ actionmailer (7.0.3.1)
26
+ actionpack (= 7.0.3.1)
27
+ actionview (= 7.0.3.1)
28
+ activejob (= 7.0.3.1)
29
+ activesupport (= 7.0.3.1)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.3)
36
- actionview (= 7.0.3)
37
- activesupport (= 7.0.3)
35
+ actionpack (7.0.3.1)
36
+ actionview (= 7.0.3.1)
37
+ activesupport (= 7.0.3.1)
38
38
  rack (~> 2.0, >= 2.2.0)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.3)
43
- actionpack (= 7.0.3)
44
- activerecord (= 7.0.3)
45
- activestorage (= 7.0.3)
46
- activesupport (= 7.0.3)
42
+ actiontext (7.0.3.1)
43
+ actionpack (= 7.0.3.1)
44
+ activerecord (= 7.0.3.1)
45
+ activestorage (= 7.0.3.1)
46
+ activesupport (= 7.0.3.1)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.3)
50
- activesupport (= 7.0.3)
49
+ actionview (7.0.3.1)
50
+ activesupport (= 7.0.3.1)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.3)
56
- activesupport (= 7.0.3)
55
+ activejob (7.0.3.1)
56
+ activesupport (= 7.0.3.1)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.3)
59
- activesupport (= 7.0.3)
60
- activerecord (7.0.3)
61
- activemodel (= 7.0.3)
62
- activesupport (= 7.0.3)
63
- activestorage (7.0.3)
64
- actionpack (= 7.0.3)
65
- activejob (= 7.0.3)
66
- activerecord (= 7.0.3)
67
- activesupport (= 7.0.3)
58
+ activemodel (7.0.3.1)
59
+ activesupport (= 7.0.3.1)
60
+ activerecord (7.0.3.1)
61
+ activemodel (= 7.0.3.1)
62
+ activesupport (= 7.0.3.1)
63
+ activestorage (7.0.3.1)
64
+ actionpack (= 7.0.3.1)
65
+ activejob (= 7.0.3.1)
66
+ activerecord (= 7.0.3.1)
67
+ activesupport (= 7.0.3.1)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.3)
70
+ activesupport (7.0.3.1)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
74
74
  tzinfo (~> 2.0)
75
+ rails (7.0.3.1)
76
+ actioncable (= 7.0.3.1)
77
+ actionmailbox (= 7.0.3.1)
78
+ actionmailer (= 7.0.3.1)
79
+ actionpack (= 7.0.3.1)
80
+ actiontext (= 7.0.3.1)
81
+ actionview (= 7.0.3.1)
82
+ activejob (= 7.0.3.1)
83
+ activemodel (= 7.0.3.1)
84
+ activerecord (= 7.0.3.1)
85
+ activestorage (= 7.0.3.1)
86
+ activesupport (= 7.0.3.1)
87
+ bundler (>= 1.15.0)
88
+ railties (= 7.0.3.1)
89
+ railties (7.0.3.1)
90
+ actionpack (= 7.0.3.1)
91
+ activesupport (= 7.0.3.1)
92
+ method_source
93
+ rake (>= 12.2)
94
+ thor (~> 1.0)
95
+ zeitwerk (~> 2.5)
96
+
97
+ GEM
98
+ remote: https://rubygems.org/
99
+ specs:
75
100
  builder (3.2.4)
76
101
  concurrent-ruby (1.1.10)
77
102
  crass (1.0.6)
78
103
  digest (3.1.0)
79
- erubi (1.10.0)
104
+ erubi (1.11.0)
80
105
  globalid (1.0.0)
81
106
  activesupport (>= 5.0)
82
- i18n (1.10.0)
107
+ i18n (1.12.0)
83
108
  concurrent-ruby (~> 1.0)
84
109
  loofah (2.18.0)
85
110
  crass (~> 1.0.2)
@@ -90,7 +115,7 @@ GEM
90
115
  method_source (1.0.0)
91
116
  mini_mime (1.1.2)
92
117
  mini_portile2 (2.8.0)
93
- minitest (5.16.1)
118
+ minitest (5.16.3)
94
119
  net-imap (0.2.3)
95
120
  digest
96
121
  net-protocol
@@ -106,48 +131,28 @@ GEM
106
131
  net-protocol
107
132
  timeout
108
133
  nio4r (2.5.8)
109
- nokogiri (1.13.6)
134
+ nokogiri (1.13.8)
110
135
  mini_portile2 (~> 2.8.0)
111
136
  racc (~> 1.4)
112
- orthoses (0.10.0)
137
+ orthoses (0.11.0)
113
138
  rbs (~> 2.0)
139
+ psych (3.3.2)
114
140
  racc (1.6.0)
115
- rack (2.2.3.1)
116
- rack-test (2.0.0)
141
+ rack (2.2.4)
142
+ rack-test (2.0.2)
117
143
  rack (>= 1.3)
118
- rails (7.0.3)
119
- actioncable (= 7.0.3)
120
- actionmailbox (= 7.0.3)
121
- actionmailer (= 7.0.3)
122
- actionpack (= 7.0.3)
123
- actiontext (= 7.0.3)
124
- actionview (= 7.0.3)
125
- activejob (= 7.0.3)
126
- activemodel (= 7.0.3)
127
- activerecord (= 7.0.3)
128
- activestorage (= 7.0.3)
129
- activesupport (= 7.0.3)
130
- bundler (>= 1.15.0)
131
- railties (= 7.0.3)
132
144
  rails-dom-testing (2.0.3)
133
145
  activesupport (>= 4.2.0)
134
146
  nokogiri (>= 1.6)
135
147
  rails-html-sanitizer (1.4.3)
136
148
  loofah (~> 2.3)
137
- railties (7.0.3)
138
- actionpack (= 7.0.3)
139
- activesupport (= 7.0.3)
140
- method_source
141
- rake (>= 12.2)
142
- thor (~> 1.0)
143
- zeitwerk (~> 2.5)
144
149
  rake (13.0.6)
145
150
  rbs (2.6.0)
146
151
  sqlite3 (1.4.4)
147
- strscan (3.0.3)
152
+ strscan (3.0.4)
148
153
  thor (1.2.1)
149
154
  timeout (0.3.0)
150
- tzinfo (2.0.4)
155
+ tzinfo (2.0.5)
151
156
  concurrent-ruby (~> 1.0)
152
157
  websocket-driver (0.7.5)
153
158
  websocket-extensions (>= 0.1.0)
@@ -155,18 +160,19 @@ GEM
155
160
  zeitwerk (2.6.0)
156
161
 
157
162
  PLATFORMS
158
- ruby
163
+ arm64-darwin-21
159
164
 
160
165
  DEPENDENCIES
161
166
  net-imap
162
167
  net-pop
163
168
  net-smtp
164
169
  orthoses-rails!
165
- rails (>= 7.0, < 7.1)
170
+ psych (~> 3)
171
+ rails!
166
172
  sqlite3
167
173
 
168
174
  RUBY VERSION
169
175
  ruby 3.1.1p18
170
176
 
171
177
  BUNDLED WITH
172
- 2.3.9
178
+ 2.3.16
@@ -22,24 +22,29 @@ def generate(out_dir, version)
22
22
  require "active_model"
23
23
  require "active_storage/engine"
24
24
  require "action_dispatch"
25
- require "action_mailbox"
25
+ begin
26
+ require "action_mailbox"
27
+ require "action_text"
28
+ rescue LoadError
29
+ end
26
30
  require "action_mailer"
27
31
  require "action_pack"
28
- require "action_text"
29
32
  require "action_view"
30
33
 
31
- [
34
+ roots = [
32
35
  ActiveSupport,
33
36
  ActiveModel,
34
37
  ActiveJob,
35
38
  ActiveRecord,
36
39
  ActiveStorage,
37
40
  ActionDispatch,
38
- ActionMailbox,
39
41
  ActionMailer,
40
- ActionText,
41
42
  ActionView,
42
- ].each do |rails_mod|
43
+ ]
44
+ roots << ActionMailbox if defined?(ActionMailbox)
45
+ roots << ActionText if defined?(ActionText)
46
+
47
+ roots.each do |rails_mod|
43
48
  rails_mod.eager_load!
44
49
  Orthoses::Utils.each_const_recursive(rails_mod, on_error: -> (e) {
45
50
  Orthoses.logger.warn "skip load const by [#{e.root}][#{e.const}](#{e.error.class})#{e.error.message}"
@@ -62,7 +67,6 @@ def generate(out_dir, version)
62
67
  use Orthoses::CreateFileByName,
63
68
  base_dir: "#{out_dir}/#{version}",
64
69
  header: "# !!! GENERATED CODE !!!\n# Please see generators/rails-generator"
65
- use Orthoses::AvoidRecursiveAncestorError
66
70
  use Orthoses::Filter,
67
71
  if: -> (name, content) {
68
72
  # OMG, both ERB and Erb are exist...
@@ -87,9 +91,10 @@ def generate(out_dir, version)
87
91
  on_error: -> (e) {
88
92
  Orthoses.logger.warn "[Orthoses::Constant] skip load const by #{e.root}[::#{e.const}] (#{e.error.class}) #{e.error.message}"
89
93
  }
90
- Orthoses::ActiveSupport.each do |middleware, **args|
91
- use middleware, **args
92
- end
94
+ use Orthoses::ActiveSupport::ClassAttribute
95
+ use Orthoses::ActiveSupport::Delegation
96
+ use Orthoses::ActiveSupport::MattrAccessor
97
+ use Orthoses::ActiveSupport::TimeWithZone
93
98
  use Orthoses::ActiveRecord::QueryMethods
94
99
  use Orthoses::LoadRBS,
95
100
  paths: -> { Orthoses::PathHelper.best_version_paths(::ActiveRecord::VERSION::STRING, "known_sig/activerecord") }
@@ -114,6 +119,9 @@ def generate(out_dir, version)
114
119
  elsif defined?(ActiveRecord::Migration::Compatibility::V6_0)
115
120
  store["ActiveRecord::Migration::Compatibility::V5_2"].header = nil
116
121
  store["ActiveRecord::Migration::Compatibility::V6_0"].header = "class ActiveRecord::Migration::Compatibility::V6_0 < ActiveRecord::Migration::Current"
122
+ elsif defined?(ActiveRecord::Migration::Compatibility::V5_2)
123
+ store["ActiveRecord::Migration::Compatibility::V5_1"].header = nil
124
+ store["ActiveRecord::Migration::Compatibility::V5_2"].header = "class ActiveRecord::Migration::Compatibility::V5_2 < ActiveRecord::Migration::Current"
117
125
  end
118
126
  end
119
127
  # class_eval in #each
@@ -182,6 +190,13 @@ def generate(out_dir, version)
182
190
  end
183
191
  use Orthoses::DelegateClass
184
192
  use Orthoses::Attribute
193
+ use Orthoses::Railties::Mixin, callback: -> (railties_mixin) {
194
+ Orthoses::CreateFileByName.new(
195
+ ->{ railties_mixin },
196
+ base_dir: "#{out_dir}/#{version}/railties_mixin",
197
+ header: "# !!! GENERATED CODE !!!\n# Please see generators/rails-generator"
198
+ ).call
199
+ }
185
200
  use Orthoses::Mixin,
186
201
  if: -> (base_mod, how, mod) {
187
202
  mod != Enumerable # TODO
@@ -251,6 +266,13 @@ def generate_test_script(gem:, version:, export:, stdlib_dependencies:, gem_depe
251
266
  RUBY
252
267
  end
253
268
 
269
+ def generate_manifest(export:, stdlib_dependencies:)
270
+ Pathname(export).join('manifest.yaml').write(<<~YAML)
271
+ dependencies:
272
+ #{stdlib_dependencies.map{"- name: #{_1}"}.join("\n ")}
273
+ YAML
274
+ end
275
+
254
276
  VERSIONS = %w[
255
277
  6.0
256
278
  6.1
@@ -258,57 +280,49 @@ VERSIONS = %w[
258
280
  ]
259
281
  Object.private_constant :VERSIONS
260
282
 
261
- GEMS = %w[
262
- active_support
263
- active_model
264
- active_record
265
- active_job
266
- active_storage
267
- ]
283
+ tasks = Dir["tasks/*"]
284
+ tasks.each do |task|
285
+ load task
286
+ end
287
+ GEMS = tasks.map { File.basename(_1).sub(/\.rake/, '') }
268
288
  Object.private_constant :GEMS
269
289
 
270
290
  task :clean do
271
291
  FileUtils.rm_rf("out")
272
292
  end
273
293
 
274
- namespace :bundle do
275
- task :update do
276
- VERSIONS.each do |version|
277
- sh "BUNDLE_GEMFILE=gemfiles/Gemfile_#{version.tr('.', '_')} bundle update"
278
- end
279
- end
280
- end
281
-
282
294
  VERSIONS.each do |version|
283
295
  namespace version do
284
296
  desc "run all version=#{version}"
285
297
  task :all => [
286
- "#{version}:generate",
287
- *(GEMS.map{"#{version}:#{_1}:export"}),
288
- # *(GEMS.map{"#{version}:#{_1}:validate"}),
289
- # *(GEMS.map{"#{version}:#{_1}:install"})
298
+ :generate,
299
+ :export,
300
+ :validate,
301
+ # :install,
290
302
  ]
291
303
 
304
+ desc "run export version=#{version}"
305
+ task :export => GEMS.map{"#{version}:#{_1}:export"}
306
+
307
+ desc "run validate version=#{version}"
308
+ task :validate => GEMS.map{"#{version}:#{_1}:validate"}
309
+
310
+ desc "run install version=#{version}"
311
+ task :install => GEMS.map{"#{version}:#{_1}:install"}
312
+
292
313
  desc "generate version=#{version}"
293
314
  task :generate do |t|
294
- gemfile = File.expand_path("gemfiles/Gemfile_#{version.tr('.', '_')}")
295
- sh "BUNDLE_GEMFILE=#{gemfile} bundle install"
296
- sh "BUNDLE_GEMFILE=#{gemfile} bundle exec rake #{t.name}_exec"
315
+ switch_branch("#{version.tr('.', '-')}-stable")
316
+ sh "bundle install"
317
+ sh "bundle exec rake #{t.name}_exec"
297
318
  end
298
319
 
299
320
  task :generate_exec do
300
- switch_branch("#{version.tr('.', '-')}-stable")
301
321
  generate("out", version)
302
322
  end
303
323
  end
304
324
  end
305
325
 
306
- load 'tasks/active_job.rake'
307
- load 'tasks/active_model.rake'
308
- load 'tasks/active_record.rake'
309
- load 'tasks/active_storage.rake'
310
- load 'tasks/active_support.rake'
311
-
312
326
  task default: [
313
327
  :clean,
314
328
  *(VERSIONS.map {"#{_1}:all"})
@@ -0,0 +1,4 @@
1
+ module ActionController
2
+ class Metal < AbstractController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ActiveModel::Serialization
2
+ # https://github.com/ruby/rbs/issues/1008
3
+ def send: (Object::name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
4
+ end
@@ -0,0 +1,4 @@
1
+ module ActiveModel::Validations
2
+ # https://github.com/ruby/rbs/issues/1008
3
+ def send: (Object::name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
4
+ end
@@ -0,0 +1,49 @@
1
+ interface _ActiveRecord_Relation[Model, PrimaryKey]
2
+ def all: () -> self
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> self
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> self
8
+ def not: (*untyped) -> self
9
+ def exists?: (*untyped) -> bool
10
+ def order: (*untyped) -> self
11
+ def group: (*Symbol | String) -> untyped
12
+ def distinct: () -> self
13
+ def or: (self) -> self
14
+ def merge: (self) -> self
15
+ def joins: (*String | Symbol) -> self
16
+ | (Hash[untyped, untyped]) -> self
17
+ def left_joins: (*String | Symbol) -> self
18
+ | (Hash[untyped, untyped]) -> self
19
+ def left_outer_joins: (*String | Symbol) -> self
20
+ | (Hash[untyped, untyped]) -> self
21
+ def includes: (*String | Symbol) -> self
22
+ | (Hash[untyped, untyped]) -> self
23
+ def eager_load: (*String | Symbol) -> self
24
+ | (Hash[untyped, untyped]) -> self
25
+ def preload: (*String | Symbol) -> self
26
+ | (Hash[untyped, untyped]) -> self
27
+ def find_by: (*untyped) -> Model?
28
+ def find_by!: (*untyped) -> Model
29
+ def find: (PrimaryKey id) -> Model
30
+ | (Array[PrimaryKey]) -> Array[Model]
31
+ | (*PrimaryKey) -> Array[Model]
32
+ | () { (Model) -> boolish } -> Model?
33
+ def first: () -> Model?
34
+ | (Integer count) -> Array[Model]
35
+ def first!: () -> Model
36
+ def last: () -> Model?
37
+ | (Integer count) -> Array[Model]
38
+ def last!: () -> Model
39
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
40
+ def limit!: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
41
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
42
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
43
+ def destroy_all: () -> untyped
44
+ def delete_all: () -> untyped
45
+ def update_all: (*untyped) -> untyped
46
+ def each: () { (Model) -> void } -> self
47
+ def select: (*Symbol | String) -> self
48
+ | () { (Model) -> boolish } -> Array[Model]
49
+ end
@@ -0,0 +1,45 @@
1
+ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey]
2
+ def all: () -> Relation
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> Relation
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> Relation
8
+ def exists?: (*untyped) -> bool
9
+ def order: (*untyped) -> Relation
10
+ def group: (*Symbol | String) -> untyped
11
+ def distinct: () -> self
12
+ def or: (Relation) -> Relation
13
+ def merge: (Relation) -> Relation
14
+ def joins: (*String | Symbol) -> self
15
+ | (Hash[untyped, untyped]) -> self
16
+ def left_joins: (*String | Symbol) -> self
17
+ | (Hash[untyped, untyped]) -> self
18
+ def left_outer_joins: (*String | Symbol) -> self
19
+ | (Hash[untyped, untyped]) -> self
20
+ def includes: (*String | Symbol) -> self
21
+ | (Hash[untyped, untyped]) -> self
22
+ def eager_load: (*String | Symbol) -> self
23
+ | (Hash[untyped, untyped]) -> self
24
+ def preload: (*String | Symbol) -> self
25
+ | (Hash[untyped, untyped]) -> self
26
+ def find_by: (*untyped) -> Model?
27
+ def find_by!: (*untyped) -> Model
28
+ def find: (PrimaryKey id) -> Model
29
+ | (Array[PrimaryKey]) -> Array[Model]
30
+ | (*PrimaryKey) -> Array[Model]
31
+ def first: () -> Model?
32
+ | (Integer count) -> Array[Model]
33
+ def first!: () -> Model
34
+ def last: () -> Model?
35
+ | (Integer count) -> Array[Model]
36
+ def last!: () -> Model
37
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> Relation
38
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
39
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
40
+ def destroy_all: () -> untyped
41
+ def delete_all: () -> untyped
42
+ def update_all: (*untyped) -> untyped
43
+ def select: (*Symbol | String) -> Relation
44
+ | () { (Model) -> boolish } -> Array[Model]
45
+ end
@@ -0,0 +1,5 @@
1
+ class ActiveRecord::Result
2
+ include Enumerable[Hash[String, untyped]]
3
+ def each: () -> Enumerator[Hash[String, untyped], Array[Hash[String, untyped]]]
4
+ | () { (Hash[String, untyped]) -> void } -> Array[Hash[String, untyped]]
5
+ end
@@ -0,0 +1,49 @@
1
+ interface _ActiveRecord_Relation[Model, PrimaryKey]
2
+ def all: () -> self
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> self
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> self
8
+ def not: (*untyped) -> self
9
+ def exists?: (*untyped) -> bool
10
+ def order: (*untyped) -> self
11
+ def group: (*Symbol | String) -> untyped
12
+ def distinct: () -> self
13
+ def or: (self) -> self
14
+ def merge: (self) -> self
15
+ def joins: (*String | Symbol) -> self
16
+ | (Hash[untyped, untyped]) -> self
17
+ def left_joins: (*String | Symbol) -> self
18
+ | (Hash[untyped, untyped]) -> self
19
+ def left_outer_joins: (*String | Symbol) -> self
20
+ | (Hash[untyped, untyped]) -> self
21
+ def includes: (*String | Symbol) -> self
22
+ | (Hash[untyped, untyped]) -> self
23
+ def eager_load: (*String | Symbol) -> self
24
+ | (Hash[untyped, untyped]) -> self
25
+ def preload: (*String | Symbol) -> self
26
+ | (Hash[untyped, untyped]) -> self
27
+ def find_by: (*untyped) -> Model?
28
+ def find_by!: (*untyped) -> Model
29
+ def find: (PrimaryKey id) -> Model
30
+ | (Array[PrimaryKey]) -> Array[Model]
31
+ | (*PrimaryKey) -> Array[Model]
32
+ | () { (Model) -> boolish } -> Model?
33
+ def first: () -> Model?
34
+ | (Integer count) -> Array[Model]
35
+ def first!: () -> Model
36
+ def last: () -> Model?
37
+ | (Integer count) -> Array[Model]
38
+ def last!: () -> Model
39
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
40
+ def limit!: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
41
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
42
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
43
+ def destroy_all: () -> untyped
44
+ def delete_all: () -> untyped
45
+ def update_all: (*untyped) -> untyped
46
+ def each: () { (Model) -> void } -> self
47
+ def select: (*Symbol | String) -> self
48
+ | () { (Model) -> boolish } -> Array[Model]
49
+ end
@@ -0,0 +1,45 @@
1
+ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey]
2
+ def all: () -> Relation
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> Relation
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> Relation
8
+ def exists?: (*untyped) -> bool
9
+ def order: (*untyped) -> Relation
10
+ def group: (*Symbol | String) -> untyped
11
+ def distinct: () -> self
12
+ def or: (Relation) -> Relation
13
+ def merge: (Relation) -> Relation
14
+ def joins: (*String | Symbol) -> self
15
+ | (Hash[untyped, untyped]) -> self
16
+ def left_joins: (*String | Symbol) -> self
17
+ | (Hash[untyped, untyped]) -> self
18
+ def left_outer_joins: (*String | Symbol) -> self
19
+ | (Hash[untyped, untyped]) -> self
20
+ def includes: (*String | Symbol) -> self
21
+ | (Hash[untyped, untyped]) -> self
22
+ def eager_load: (*String | Symbol) -> self
23
+ | (Hash[untyped, untyped]) -> self
24
+ def preload: (*String | Symbol) -> self
25
+ | (Hash[untyped, untyped]) -> self
26
+ def find_by: (*untyped) -> Model?
27
+ def find_by!: (*untyped) -> Model
28
+ def find: (PrimaryKey id) -> Model
29
+ | (Array[PrimaryKey]) -> Array[Model]
30
+ | (*PrimaryKey) -> Array[Model]
31
+ def first: () -> Model?
32
+ | (Integer count) -> Array[Model]
33
+ def first!: () -> Model
34
+ def last: () -> Model?
35
+ | (Integer count) -> Array[Model]
36
+ def last!: () -> Model
37
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> Relation
38
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
39
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
40
+ def destroy_all: () -> untyped
41
+ def delete_all: () -> untyped
42
+ def update_all: (*untyped) -> untyped
43
+ def select: (*Symbol | String) -> Relation
44
+ | () { (Model) -> boolish } -> Array[Model]
45
+ end
@@ -0,0 +1,5 @@
1
+ class ActiveRecord::Result
2
+ include Enumerable[Hash[String, untyped]]
3
+ def each: () -> Enumerator[Hash[String, untyped], Array[Hash[String, untyped]]]
4
+ | () { (Hash[String, untyped]) -> void } -> Array[Hash[String, untyped]]
5
+ end