Skip to content

Commit 3dc95fa

Browse files
authored
feat(sorbet): add manual RBI files for various modules and classes (#214)
1 parent 5f261ad commit 3dc95fa

13 files changed

+905
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# typed: strict
2+
3+
# ActionController helpers and methods
4+
module ActionController
5+
class Base
6+
extend T::Sig
7+
8+
# I18n helpers
9+
sig { params(key: T.any(String, Symbol), options: T.untyped).returns(String) }
10+
def t(key, **options); end
11+
12+
sig { params(key: T.any(String, Symbol), options: T.untyped).returns(String) }
13+
def translate(key, **options); end
14+
15+
sig { params(key: T.any(String, Symbol), count: T.untyped, options: T.untyped).returns(String) }
16+
def l(key, count = nil, **options); end
17+
18+
sig { params(key: T.any(String, Symbol), count: T.untyped, options: T.untyped).returns(String) }
19+
def localize(key, count = nil, **options); end
20+
end
21+
end
22+
23+
# EN14960 CalculatorResponse
24+
module EN14960
25+
class CalculatorResponse
26+
extend T::Sig
27+
28+
sig { returns(T.nilable(String)) }
29+
def value_suffix; end
30+
end
31+
end
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# typed: strict
2+
3+
# ActiveRecord callback methods
4+
module ActiveRecord
5+
module Callbacks
6+
module ClassMethods
7+
extend T::Sig
8+
9+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
10+
def after_create(*args, &block); end
11+
12+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
13+
def after_destroy(*args, &block); end
14+
15+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
16+
def after_save(*args, &block); end
17+
18+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
19+
def after_update(*args, &block); end
20+
21+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
22+
def after_validation(*args, &block); end
23+
24+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
25+
def around_create(*args, &block); end
26+
27+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
28+
def around_destroy(*args, &block); end
29+
30+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
31+
def around_save(*args, &block); end
32+
33+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
34+
def around_update(*args, &block); end
35+
36+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
37+
def before_create(*args, &block); end
38+
39+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
40+
def before_destroy(*args, &block); end
41+
42+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
43+
def before_save(*args, &block); end
44+
45+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
46+
def before_update(*args, &block); end
47+
48+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
49+
def before_validation(*args, &block); end
50+
51+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
52+
def after_commit(*args, &block); end
53+
54+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
55+
def after_rollback(*args, &block); end
56+
57+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
58+
def after_initialize(*args, &block); end
59+
60+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
61+
def after_find(*args, &block); end
62+
63+
sig { params(args: T.untyped, block: T.nilable(T.proc.void)).void }
64+
def after_touch(*args, &block); end
65+
end
66+
end
67+
end
68+
69+
# Make callbacks available on ActiveRecord::Base
70+
class ActiveRecord::Base
71+
extend ActiveRecord::Callbacks::ClassMethods
72+
end
73+
74+
# Make callbacks available on concerns
75+
module ActiveSupport
76+
module Concern
77+
module ClassMethods
78+
include ActiveRecord::Callbacks::ClassMethods
79+
end
80+
end
81+
end
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# typed: strict
2+
3+
# ActiveSupport extensions to core Ruby classes
4+
5+
class Date
6+
extend T::Sig
7+
8+
sig { returns(Date) }
9+
def self.current; end
10+
11+
sig { returns(Date) }
12+
def self.today; end
13+
14+
sig { returns(Date) }
15+
def self.tomorrow; end
16+
17+
sig { returns(Date) }
18+
def self.yesterday; end
19+
end
20+
21+
class Integer
22+
extend T::Sig
23+
24+
sig { returns(ActiveSupport::Duration) }
25+
def days; end
26+
27+
sig { returns(ActiveSupport::Duration) }
28+
def hours; end
29+
30+
sig { returns(ActiveSupport::Duration) }
31+
def minutes; end
32+
33+
sig { returns(ActiveSupport::Duration) }
34+
def seconds; end
35+
36+
sig { returns(ActiveSupport::Duration) }
37+
def weeks; end
38+
39+
sig { returns(ActiveSupport::Duration) }
40+
def months; end
41+
42+
sig { returns(ActiveSupport::Duration) }
43+
def years; end
44+
45+
sig { returns(ActiveSupport::Duration) }
46+
def day; end
47+
48+
sig { returns(ActiveSupport::Duration) }
49+
def hour; end
50+
51+
sig { returns(ActiveSupport::Duration) }
52+
def minute; end
53+
54+
sig { returns(ActiveSupport::Duration) }
55+
def second; end
56+
57+
sig { returns(ActiveSupport::Duration) }
58+
def week; end
59+
60+
sig { returns(ActiveSupport::Duration) }
61+
def month; end
62+
63+
sig { returns(ActiveSupport::Duration) }
64+
def year; end
65+
end
66+
67+
module ActiveSupport
68+
class Duration
69+
extend T::Sig
70+
71+
sig { returns(Float) }
72+
def to_f; end
73+
74+
sig { returns(Integer) }
75+
def to_i; end
76+
77+
sig { params(time: T.any(Time, Date, DateTime)).returns(T.any(Time, Date, DateTime)) }
78+
def ago(time = Time.current); end
79+
80+
sig { params(time: T.any(Time, Date, DateTime)).returns(T.any(Time, Date, DateTime)) }
81+
def since(time = Time.current); end
82+
83+
sig { params(time: T.any(Time, Date, DateTime)).returns(T.any(Time, Date, DateTime)) }
84+
def from_now(time = Time.current); end
85+
86+
sig { params(time: T.any(Time, Date, DateTime)).returns(T.any(Time, Date, DateTime)) }
87+
def before(time); end
88+
89+
sig { params(time: T.any(Time, Date, DateTime)).returns(T.any(Time, Date, DateTime)) }
90+
def after(time); end
91+
end
92+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# typed: strict
2+
3+
module ActiveSupport
4+
class ArrayInquirer < Array; end
5+
class StringInquirer < String; end
6+
class SafeBuffer < String; end
7+
class TimeZone; end
8+
class TimeWithZone; end
9+
10+
class HashWithIndifferentAccess < Hash
11+
extend T::Sig
12+
extend T::Generic
13+
14+
K = type_member
15+
V = type_member
16+
end
17+
18+
module Multibyte
19+
class Chars; end
20+
end
21+
end
22+
23+
module DateAndTime
24+
module Zones; end
25+
module Calculations; end
26+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# typed: strict
2+
3+
# ChobbleForms module and its utilities
4+
module ChobbleForms
5+
class FieldUtils
6+
extend T::Sig
7+
8+
sig { params(field: T.any(Symbol, String)).returns(T::Boolean) }
9+
def self.is_comment_field?(field); end
10+
11+
sig { params(field: T.any(Symbol, String)).returns(T::Boolean) }
12+
def self.is_pass_field?(field); end
13+
14+
sig { params(field: T.any(Symbol, String)).returns(Symbol) }
15+
def self.strip_field_suffix(field); end
16+
end
17+
end
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# typed: strict
2+
3+
# Additional model associations and methods not captured by Tapioca
4+
5+
class User < ApplicationRecord
6+
extend T::Sig
7+
8+
sig { returns(T.nilable(InspectorCompany)) }
9+
def inspection_company; end
10+
11+
sig { params(value: T.nilable(InspectorCompany)).void }
12+
def inspection_company=(value); end
13+
end
14+
15+
class Inspection < ApplicationRecord
16+
extend T::Sig
17+
18+
# Attributes from database
19+
sig { returns(T.nilable(DateTime)) }
20+
def complete_date; end
21+
22+
sig { params(value: T.nilable(DateTime)).void }
23+
def complete_date=(value); end
24+
25+
sig { returns(T.nilable(DateTime)) }
26+
def inspection_date; end
27+
28+
sig { params(value: T.nilable(DateTime)).void }
29+
def inspection_date=(value); end
30+
31+
sig { returns(T.nilable(Float)) }
32+
def length; end
33+
34+
sig { params(value: T.nilable(Float)).void }
35+
def length=(value); end
36+
37+
sig { returns(T.nilable(Float)) }
38+
def width; end
39+
40+
sig { params(value: T.nilable(Float)).void }
41+
def width=(value); end
42+
43+
sig { returns(T.nilable(Float)) }
44+
def height; end
45+
46+
sig { params(value: T.nilable(Float)).void }
47+
def height=(value); end
48+
49+
sig { returns(T::Boolean) }
50+
def has_slide; end
51+
52+
sig { params(value: T::Boolean).void }
53+
def has_slide=(value); end
54+
55+
sig { returns(T::Boolean) }
56+
def has_slide?; end
57+
58+
sig { returns(T::Boolean) }
59+
def is_totally_enclosed; end
60+
61+
sig { params(value: T::Boolean).void }
62+
def is_totally_enclosed=(value); end
63+
64+
sig { returns(T::Boolean) }
65+
def is_totally_enclosed?; end
66+
67+
sig { returns(T::Boolean) }
68+
def indoor_only; end
69+
70+
sig { params(value: T::Boolean).void }
71+
def indoor_only=(value); end
72+
73+
sig { returns(T::Boolean) }
74+
def indoor_only?; end
75+
76+
sig { returns(T::Boolean) }
77+
def passed; end
78+
79+
sig { params(value: T::Boolean).void }
80+
def passed=(value); end
81+
82+
sig { returns(T::Boolean) }
83+
def bouncing_pillow?; end
84+
85+
# Associations
86+
sig { returns(T.nilable(Unit)) }
87+
def unit; end
88+
89+
sig { params(value: T.nilable(Unit)).void }
90+
def unit=(value); end
91+
92+
# ActiveRecord methods
93+
sig { params(args: T.untyped).void }
94+
def update!(args); end
95+
96+
sig { returns(T::Boolean) }
97+
def complete?; end
98+
end

0 commit comments

Comments
 (0)