Module: Alplus::ActiveJob

Defined in:
lib/alplus/active_job.rb

Overview

Optional ActiveJob integration. Namespaced under Alplus::ActiveJob (not top-level) so it never collides with ::ActiveJob. Safe to load unconditionally -- alplus.rb only require_relatives this file when defined?(::ActiveJob::Base) is already true, and install! re-checks that guard, so a host app that never loads ActiveJob never activates any of this. This gem's runtime dependency list stays empty either way: active_support/concern is part of ActiveJob's own dependency tree, never required unless ActiveJob already pulled it in.

Defined Under Namespace

Modules: ErrorReporting

Class Method Summary collapse

Class Method Details

.install!Object

Idempotent: mixing ErrorReporting into ::ActiveJob::Base more than once is a no-op (Ruby's own Module#include is already idempotent for the same module, but @installed also skips the guard checks/log-free re-run cheaply).



63
64
65
66
67
68
69
# File 'lib/alplus/active_job.rb', line 63

def install!
  return if @installed
  return unless defined?(::ActiveJob::Base)

  ::ActiveJob::Base.include(ErrorReporting)
  @installed = true
end

.reset!Object

Test-only: lets a spec re-drive install!. Not called by production code.



73
74
75
# File 'lib/alplus/active_job.rb', line 73

def reset!
  @installed = false
end