Skip to content

Commit

Permalink
Add ActiveSupport::Rescuable::ClassMethods
Browse files Browse the repository at this point in the history
This annotation binds the block param of `rescue_from`
to `T.attached_class` so that sorbet can correctly identify that the scope
is the instance of the controller.
  • Loading branch information
cquinones100 committed Sep 25, 2024
1 parent ca8d726 commit 371f356
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rbi/annotations/activesupport.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,17 @@ class ActiveSupport::ErrorReporter
end
def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
end

module ActiveSupport::Rescuable::ClassMethods
has_attached_class!

sig {
params(
klasses: T.any(Module, String),
with: T.nilable(Symbol),
block: T.nilable(T.proc.params(exception: Exception).bind(T.attached_class).void)
)
.void
}
def rescue_from(*klasses, with:, &block); end
end

0 comments on commit 371f356

Please sign in to comment.