aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/configured_job.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activejob/lib/active_job/configured_job.rb')
-rw-r--r--activejob/lib/active_job/configured_job.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activejob/lib/active_job/configured_job.rb b/activejob/lib/active_job/configured_job.rb
new file mode 100644
index 0000000000..67daf48b36
--- /dev/null
+++ b/activejob/lib/active_job/configured_job.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module ActiveJob
+ class ConfiguredJob #:nodoc:
+ def initialize(job_class, options = {})
+ @options = options
+ @job_class = job_class
+ end
+
+ def perform_now(*args)
+ @job_class.new(*args).perform_now
+ end
+
+ def perform_later(*args)
+ @job_class.new(*args).enqueue @options
+ end
+ end
+end