orthoses-rails 0.9.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -65
  3. data/lib/generators/orthoses/rails/install_generator.rb +18 -0
  4. data/lib/generators/orthoses/rails/templates/rails.rake +31 -0
  5. data/lib/orthoses/active_record/belongs_to.rb +15 -4
  6. data/lib/orthoses/active_record/enum.rb +5 -0
  7. data/lib/orthoses/active_record/generated_attribute_methods.rb +47 -55
  8. data/lib/orthoses/active_record/has_many.rb +15 -4
  9. data/lib/orthoses/active_record/has_one.rb +12 -2
  10. data/lib/orthoses/active_record/relation.rb +56 -0
  11. data/lib/orthoses/active_record/secure_token.rb +28 -0
  12. data/lib/orthoses/active_record.rb +37 -0
  13. data/lib/orthoses/active_storage/attached/model.rb +47 -0
  14. data/lib/orthoses/active_storage.rb +3 -0
  15. data/lib/orthoses/active_support/aliasing.rb +34 -0
  16. data/lib/orthoses/active_support/delegation.rb +17 -6
  17. data/lib/orthoses/active_support/time_with_zone.rb +30 -21
  18. data/lib/orthoses/active_support.rb +1 -0
  19. data/lib/orthoses/rails/application.rb +47 -0
  20. data/lib/orthoses/rails/version.rb +1 -1
  21. data/lib/orthoses/rails.rb +4 -2
  22. metadata +13 -45
  23. data/examples/rails/Gemfile +0 -16
  24. data/examples/rails/Gemfile.lock +0 -179
  25. data/examples/rails/Rakefile +0 -328
  26. data/examples/rails/config/database.yml +0 -8
  27. data/examples/rails/config/storage.yml +0 -3
  28. data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +0 -4
  29. data/examples/rails/known_sig/activemodel/7.0/active_model/serialization.rbs +0 -4
  30. data/examples/rails/known_sig/activemodel/7.0/active_model/validations.rbs +0 -4
  31. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +0 -49
  32. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +0 -45
  33. data/examples/rails/known_sig/activerecord/6.0/active_record/result.rbs +0 -5
  34. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +0 -49
  35. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +0 -45
  36. data/examples/rails/known_sig/activerecord/6.1/active_record/result.rbs +0 -5
  37. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +0 -49
  38. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +0 -45
  39. data/examples/rails/known_sig/activerecord/7.0/active_record/encryption/context.rbs +0 -9
  40. data/examples/rails/known_sig/activerecord/7.0/active_record/result.rbs +0 -5
  41. data/examples/rails/known_sig/activesupport/7.0/active_support/callbacks/callback_chain.rbs +0 -9
  42. data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +0 -4
  43. data/examples/rails/known_sig/activesupport/7.0/active_support/hash_with_indifferent_access.rbs +0 -6
  44. data/examples/rails/known_sig/activesupport/7.0/active_support/multibyte/chars.rbs +0 -7
  45. data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +0 -5
  46. data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +0 -3
  47. data/examples/rails/known_sig/activesupport/7.0/date.rbs +0 -6
  48. data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +0 -4
  49. data/examples/rails/known_sig/activesupport/7.0/hash_with_indifferent_access.rbs +0 -2
  50. data/examples/rails/known_sig/activesupport/7.0/integer.rbs +0 -9
  51. data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +0 -15
  52. data/examples/rails/known_sig/activesupport/7.0/string.rbs +0 -4
  53. data/examples/rails/known_sig/activesupport/7.0/time.rbs +0 -46
  54. data/examples/rails/tasks/action_pack.rake +0 -141
  55. data/examples/rails/tasks/action_view.rake +0 -77
  56. data/examples/rails/tasks/active_job.rake +0 -99
  57. data/examples/rails/tasks/active_model.rake +0 -46
  58. data/examples/rails/tasks/active_record.rake +0 -88
  59. data/examples/rails/tasks/active_storage.rake +0 -94
  60. data/examples/rails/tasks/active_support.rake +0 -99
  61. data/examples/rails/tasks/railties.rake +0 -34
  62. data/orthoses-rails.gemspec +0 -36
@@ -1,328 +0,0 @@
1
- ## run `$ rake`
2
-
3
- def switch_branch(name)
4
- cd "_src" do
5
- sh "git switch #{name}"
6
- end
7
- end
8
-
9
- def generate(out_dir, version)
10
- require 'orthoses'
11
- require 'orthoses-rails'
12
- require 'openssl'
13
- require 'cgi'
14
- require 'uri'
15
-
16
- Orthoses.logger.level = :error
17
-
18
- loader = -> () {
19
- require "active_support/all"
20
- require "active_record"
21
- require "active_job"
22
- require "active_model"
23
- require "active_storage/engine"
24
- require "action_dispatch"
25
- begin
26
- require "action_mailbox"
27
- require "action_text"
28
- rescue LoadError
29
- end
30
- require "action_mailer"
31
- require "action_pack"
32
- require "action_view"
33
-
34
- roots = [
35
- ActiveSupport,
36
- ActiveModel,
37
- ActiveJob,
38
- ActiveRecord,
39
- ActiveStorage,
40
- ActionDispatch,
41
- ActionMailer,
42
- ActionView,
43
- ]
44
- roots << ActionMailbox if defined?(ActionMailbox)
45
- roots << ActionText if defined?(ActionText)
46
-
47
- roots.each do |rails_mod|
48
- rails_mod.eager_load!
49
- Orthoses::Utils.each_const_recursive(rails_mod, on_error: -> (e) {
50
- Orthoses.logger.warn "skip load const by [#{e.root}][#{e.const}](#{e.error.class})#{e.error.message}"
51
- })
52
- v = rails_mod.respond_to?(:version) ? rails_mod.version : nil
53
- puts "loaded #{rails_mod}: v#{v}"
54
- end
55
- eval(<<~RUBY)
56
- module Dummy
57
- class Application < Rails::Application
58
- config.load_defaults #{version.to_s}
59
- config.active_storage.service = :local
60
- end
61
- end
62
- RUBY
63
- ENV['RAILS_ENV'] = 'development'
64
- Rails.application.initialize!
65
- }
66
- Orthoses::Builder.new do
67
- use Orthoses::CreateFileByName,
68
- base_dir: "#{out_dir}/#{version}",
69
- header: "# !!! GENERATED CODE !!!\n# Please see generators/rails-generator"
70
- use Orthoses::Filter do |name, content|
71
- # OMG, both ERB and Erb are exist...
72
- return false if name.start_with?("Erb")
73
-
74
- # ArgumentError
75
- return false if name.start_with?("I18n::Tests")
76
-
77
- # FIXME: too hard
78
- return false if name.include?("::Generators")
79
-
80
- # Ignore known sig
81
- return false if Orthoses::Utils.rbs_defined_class?(name, collection: true) && content.body.empty?
82
-
83
- true
84
- end
85
- use Orthoses::Constant,
86
- strict: false,
87
- if: -> (current, const, _val, _rbs) {
88
- !Orthoses::Utils.rbs_defined_const?("#{current}::#{const}", collection: true)
89
- },
90
- on_error: -> (e) {
91
- Orthoses.logger.warn "[Orthoses::Constant] skip load const by #{e.root}[::#{e.const}] (#{e.error.class}) #{e.error.message}"
92
- }
93
- use Orthoses::ActiveSupport::ClassAttribute
94
- use Orthoses::ActiveSupport::Delegation
95
- use Orthoses::ActiveSupport::MattrAccessor
96
- use Orthoses::ActiveSupport::TimeWithZone
97
- use Orthoses::ActiveRecord::QueryMethods
98
- use Orthoses::LoadRBS,
99
- paths: -> { Orthoses::PathHelper.best_version_paths(::ActiveRecord::VERSION::STRING, "known_sig/activerecord") }
100
- use Orthoses::LoadRBS,
101
- paths: -> { Orthoses::PathHelper.best_version_paths(::ActiveModel::VERSION::STRING, "known_sig/activemodel") }
102
- use Orthoses::LoadRBS,
103
- paths: -> { Orthoses::PathHelper.best_version_paths(::ActiveSupport::VERSION::STRING, "known_sig/activesupport") }
104
- # # require in method
105
- use Orthoses::Tap do |store|
106
- store.delete("DummyERB")
107
- store.delete("DummyCompiler")
108
- end
109
- # see activerecord/lib/active_record/migration/compatibility.rb
110
- use Orthoses::Tap do |store|
111
- # TODO: make middleware
112
- if defined?(ActiveRecord::Migration::Compatibility::V7_0)
113
- store["ActiveRecord::Migration::Compatibility::V6_1"].header = nil
114
- store["ActiveRecord::Migration::Compatibility::V7_0"].header = "class ActiveRecord::Migration::Compatibility::V7_0 < ActiveRecord::Migration::Current"
115
- elsif defined?(ActiveRecord::Migration::Compatibility::V6_1)
116
- store["ActiveRecord::Migration::Compatibility::V6_0"].header = nil
117
- store["ActiveRecord::Migration::Compatibility::V6_1"].header = "class ActiveRecord::Migration::Compatibility::V6_1 < ActiveRecord::Migration::Current"
118
- elsif defined?(ActiveRecord::Migration::Compatibility::V6_0)
119
- store["ActiveRecord::Migration::Compatibility::V5_2"].header = nil
120
- store["ActiveRecord::Migration::Compatibility::V6_0"].header = "class ActiveRecord::Migration::Compatibility::V6_0 < ActiveRecord::Migration::Current"
121
- elsif defined?(ActiveRecord::Migration::Compatibility::V5_2)
122
- store["ActiveRecord::Migration::Compatibility::V5_1"].header = nil
123
- store["ActiveRecord::Migration::Compatibility::V5_2"].header = "class ActiveRecord::Migration::Compatibility::V5_2 < ActiveRecord::Migration::Current"
124
- end
125
- end
126
- # class_eval in #each
127
- # see activerecord/lib/active_record/migration/command_recorder.rb
128
- use Orthoses::Tap do |store|
129
- content = store["ActiveRecord::Migration::CommandRecorder"]
130
- ActiveRecord::Migration::CommandRecorder::ReversibleAndIrreversibleMethods.each do |method|
131
- content << "def #{method}: (*untyped args) ?{ () -> void } -> untyped"
132
- end
133
- end
134
- # class_eval in #each
135
- # see activerecord/lib/active_record/migration/command_recorder.rb
136
- use Orthoses::Tap do |store|
137
- content = store["ActiveRecord::Migration::CommandRecorder::StraightReversions"]
138
- {
139
- execute_block: :execute_block,
140
- create_table: :drop_table,
141
- create_join_table: :drop_join_table,
142
- add_column: :remove_column,
143
- add_index: :remove_index,
144
- add_timestamps: :remove_timestamps,
145
- add_reference: :remove_reference,
146
- add_foreign_key: :remove_foreign_key,
147
- add_check_constraint: :remove_check_constraint,
148
- enable_extension: :disable_extension
149
- }.each do |cmd, inv|
150
- [[inv, cmd], [cmd, inv]].uniq.each do |method, inverse|
151
- content << "def invert_#{method}: (untyped args) ?{ () -> void } -> [Symbol, untyped, Proc]"
152
- end
153
- end
154
- end
155
- # singleton_class.class_eval in included
156
- use Orthoses::Tap do |store|
157
- store["ActiveRecord::ModelSchema"].body.tap do |body|
158
- body.delete("alias _inheritance_column= inheritance_column=")
159
- body.delete("alias inheritance_column= real_inheritance_column=")
160
- end
161
- end
162
- # alias in included block
163
- use Orthoses::Tap do |store|
164
- store["ActiveRecord::ConnectionAdapters::ColumnMethods"].body.tap do |body|
165
- body.delete("alias blob binary")
166
- body.delete("alias numeric decimal")
167
- end
168
- end
169
- # > Use async_exec instead of exec_params on pg versions before 1.1
170
- use Orthoses::Tap do |store|
171
- store["PG::Connection"].body.clear
172
- end
173
- # Entrust to auto super class
174
- use Orthoses::Tap do |store|
175
- store.each do |_, content|
176
- if content.header&.include?(" < Type::")
177
- content.header.sub!(/ < Type::(.*)/, " < ::ActiveModel::Type::\\1")
178
- end
179
- # delegate to auto_header
180
- if content.header&.start_with?("class Arel")
181
- content.header = nil
182
- end
183
- end
184
- store["ActionView::Helpers::Tags::CollectionRadioButtons::RadioButtonBuilder"].header = nil
185
- store["ActionView::Helpers::Tags::CollectionCheckBoxes::CheckBoxBuilder"].header = nil
186
- store["ActionView::SyntaxErrorInTemplate"].header = nil
187
- # MigrationProxy cannot resolve name since class alias.
188
- store["ActiveRecord::NullMigration"].header = nil
189
- end
190
- use Orthoses::DelegateClass
191
- use Orthoses::Attribute
192
- use Orthoses::Railties::Mixin, callback: -> (railties_mixin) {
193
- Orthoses::CreateFileByName.new(
194
- ->{ railties_mixin },
195
- base_dir: "#{out_dir}/#{version}/railties_mixin",
196
- header: "# !!! GENERATED CODE !!!\n# Please see generators/rails-generator"
197
- ).call
198
- }
199
- use Orthoses::Mixin,
200
- if: -> (base_mod, how, mod) {
201
- mod != Enumerable # TODO
202
- }
203
- use Orthoses::RBSPrototypeRB,
204
- paths: Dir.glob('_src/{railties,action{cable,mailbox,mailer,pack,text,view},active{job,model,record,storage,support}}/{app,lib}/**/*.rb'),
205
- constant_filter: -> (member) { false },
206
- mixin_filter: -> (member) { false },
207
- attribute_filter: -> (member) { false }
208
- use Orthoses::Autoload
209
- run loader
210
- end.call
211
-
212
- # $ cat out/7.0/**/*.rbs | wc
213
- # 69763 339342 2606899
214
- end
215
-
216
- def generate_test_script(gem:, version:, export:, stdlib_dependencies:, gem_dependencies:, rails_dependencies:)
217
- Pathname(export).join('_scripts').tap(&:mkdir).join('test').write(<<~SHELL)
218
- #!/usr/bin/env bash
219
-
220
- # !!! GENERATED CODE !!!
221
- # Please see generators/rails-generator
222
-
223
- # set -eou => Exit command with non-zero status code, Output logs of every command executed, Treat unset variables as an error when substituting.
224
- set -eou pipefail
225
- # Internal Field Separator - Linux shell variable
226
- IFS=$'\n\t'
227
- # Print shell input lines
228
- set -v
229
-
230
- # Set RBS_DIR variable to change directory to execute type checks using `steep check`
231
- RBS_DIR=$(cd $(dirname $0)/..; pwd)
232
- # Set REPO_DIR variable to validate RBS files added to the corresponding folder
233
- REPO_DIR=$(cd $(dirname $0)/../../..; pwd)
234
- # Validate RBS files, using the bundler environment present
235
- bundle exec rbs --repo=$REPO_DIR #{stdlib_dependencies.map{"-r #{_1}"}.join(" ")} \\
236
- #{gem_dependencies.map{"-r #{_1}"}.join(" ")} \\
237
- -r #{gem} validate --silent
238
-
239
- cd ${RBS_DIR}/_test
240
- # Run type checks
241
- bundle exec steep check
242
- SHELL
243
-
244
- sh "chmod +x #{Pathname(export).join('_scripts').join('test')}"
245
-
246
- Pathname(export).join('_test').tap(&:mkdir).join('Steepfile').write(<<~RUBY)
247
- # !!! GENERATED CODE !!!
248
- # Please see generators/rails-generator
249
-
250
- D = Steep::Diagnostic
251
-
252
- target :test do
253
- signature "."
254
- check "."
255
-
256
- repo_path "../../../"
257
-
258
- #{stdlib_dependencies.map{" library \"#{_1}\""}.join("\n")}
259
- #{gem_dependencies.map{" library \"#{_1}\""}.join("\n")}
260
-
261
- library "#{gem}:#{version}"
262
-
263
- configure_code_diagnostics(D::Ruby.all_error)
264
- end
265
- RUBY
266
- end
267
-
268
- def generate_manifest(export:, stdlib_dependencies:)
269
- Pathname(export).join('manifest.yaml').write(<<~YAML)
270
- dependencies:
271
- #{stdlib_dependencies.map{"- name: #{_1}"}.join("\n ")}
272
- YAML
273
- end
274
-
275
- VERSIONS = %w[
276
- 6.0
277
- 6.1
278
- 7.0
279
- ]
280
- Object.private_constant :VERSIONS
281
-
282
- tasks = Dir["tasks/*"]
283
- tasks.each do |task|
284
- load task
285
- end
286
- GEMS = tasks.map { File.basename(_1).sub(/\.rake/, '') }
287
- Object.private_constant :GEMS
288
-
289
- task :clean do
290
- FileUtils.rm_rf("out")
291
- end
292
-
293
- VERSIONS.each do |version|
294
- namespace version do
295
- desc "run all version=#{version}"
296
- task :all => [
297
- :generate,
298
- :export,
299
- :validate,
300
- # :install,
301
- ]
302
-
303
- desc "run export version=#{version}"
304
- task :export => GEMS.map{"#{version}:#{_1}:export"}
305
-
306
- desc "run validate version=#{version}"
307
- task :validate => GEMS.map{"#{version}:#{_1}:validate"}
308
-
309
- desc "run install version=#{version}"
310
- task :install => GEMS.map{"#{version}:#{_1}:install"}
311
-
312
- desc "generate version=#{version}"
313
- task :generate do |t|
314
- switch_branch("#{version.tr('.', '-')}-stable")
315
- sh "bundle install"
316
- sh "bundle exec rake #{t.name}_exec"
317
- end
318
-
319
- task :generate_exec do
320
- generate("out", version)
321
- end
322
- end
323
- end
324
-
325
- task default: [
326
- :clean,
327
- *(VERSIONS.map {"#{_1}:all"})
328
- ]
@@ -1,8 +0,0 @@
1
- development:
2
- primary: &primary
3
- adapter: sqlite3
4
- pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
5
- timeout: 5000
6
- database: ':memory:'
7
- replica:
8
- <<: *primary
@@ -1,3 +0,0 @@
1
- local:
2
- service: Disk
3
- root: <%= Rails.root.join("storage") %>
@@ -1,4 +0,0 @@
1
- module ActionController
2
- class Metal < AbstractController::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
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
@@ -1,4 +0,0 @@
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
@@ -1,49 +0,0 @@
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
@@ -1,45 +0,0 @@
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
@@ -1,5 +0,0 @@
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
@@ -1,49 +0,0 @@
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
@@ -1,45 +0,0 @@
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
@@ -1,5 +0,0 @@
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
@@ -1,49 +0,0 @@
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
@@ -1,45 +0,0 @@
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
@@ -1,9 +0,0 @@
1
- # attr_accessor in #each
2
- class ActiveRecord::Encryption::Context
3
- attr_accessor key_provider: untyped
4
- attr_accessor key_generator: untyped
5
- attr_accessor cipher: untyped
6
- attr_accessor message_serializer: untyped
7
- attr_accessor encryptor: untyped
8
- attr_accessor frozen_encryption: untyped
9
- end
@@ -1,5 +0,0 @@
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