Skip to content

Commit

Permalink
Add Active Job annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bdewater committed Dec 18, 2023
1 parent 7568f7d commit 6ad0532
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
},
"active_flag": {
},
"activejob": {
"requires": [
"active_job"
]
},
"activemodel": {
"requires": [
"active_model"
Expand Down
90 changes: 90 additions & 0 deletions rbi/annotations/activejob.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# typed: true

class ActiveJob::Base
sig { params(blk: T.proc.bind(T.attached_class).params(job: T.attached_class).void).void }
def self.after_discard(&blk); end

sig do
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void
end
def self.after_enqueue(*filters, &blk); end

sig do
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void
end
def self.after_perform(*filters, &blk); end

sig do
params(
filters: T.untyped,
blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, block: T.untyped).void)
).void
end
def self.around_enqueue(*filters, &blk); end

sig do
params(
filters: T.untyped,
blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, block: T.untyped).void)
).void
end
def self.around_perform(*filters, &blk); end

sig do
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void
end
def self.before_enqueue(*filters, &blk); end

sig do
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void
end
def self.before_perform(*filters, &blk); end

sig do
type_parameters(:ExceptionType)
.params(
exceptions: T::Class[T.type_parameter(:ExceptionType)],
block: T.nilable(
T.proc.bind(T.attached_class).params(
job: T.attached_class,
error: T.type_parameter(:ExceptionType)
).void
)
).void
end
sig do
params(
exceptions: String,
block: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, error: T.untyped).void),
).void
end
def self.discard_on(*exceptions, &block); end

sig do
params(
klasses: T.any(Module, String),
with: T.nilable(Symbol),
block: T.nilable(T.proc.bind(T.attached_class).params(exception: T.untyped).void)
).void
end
def self.rescue_from(*klasses, with: nil, &block); end

sig do
params(
exceptions: T.any(Module, String),
wait: T.any(ActiveSupport::Duration, Integer, Symbol, T.proc.params(executions: Integer).returns(Integer)),
attempts: T.any(Integer, Symbol),
queue: T.nilable(T.any(String, Symbol)),
priority: T.untyped,
jitter: Numeric,
block: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, error: T.untyped).void)
).void
end
def self.retry_on(*exceptions, wait: 3.seconds, attempts: 5, queue: nil, priority: nil, jitter: JITTER_DEFAULT, &block); end

sig { params(part_name: T.nilable(T.any(String, Symbol)), block: T.nilable(T.proc.bind(T.attached_class).returns(T.untyped))).void }
def self.queue_as(part_name = nil, &block); end

sig { params(priority: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).returns(T.untyped))).void }
def self.queue_with_priority(priority = nil, &block); end
end

0 comments on commit 6ad0532

Please sign in to comment.