Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 702 Bytes

compiler_activejob.md

File metadata and controls

29 lines (23 loc) · 702 Bytes

ActiveJob

Tapioca::Dsl::Compilers::ActiveJob generates RBI files for subclasses of ActiveJob::Base.

For example, with the following ActiveJob subclass:

class NotifyUserJob < ActiveJob::Base
  sig { params(user: User).returns(Mail) }
  def perform(user)
    # ...
  end
end

this compiler will produce the RBI file notify_user_job.rbi with the following content:

# notify_user_job.rbi
# typed: true
class NotifyUserJob
  sig { params(user: User).returns(T.any(NotifyUserJob, FalseClass)) }
  def self.perform_later(user); end

  sig { params(user: User).returns(Mail) }
  def self.perform_now(user); end
end