lib/maitredee/active_job.rb in maitredee-0.8.5 vs lib/maitredee/active_job.rb in maitredee-0.9.0

- old
+ new

@@ -13,11 +13,11 @@ def self.create_publisher_job(subclass) subclass.const_set("PublisherJob", Class.new(BasePublisherJob)) subclass::PublisherJob.service_class = subclass end - # Uses ActieJob to async the publishing + # Uses ActiveJob to async the publishing # @example To configure the specific async job open PublisherJob # class RecipePublisher < Maitredee::Publisher # class PublisherJob # queue_as :low # end @@ -25,9 +25,17 @@ # # RecipePublisher.call_later(Recipe.find(1)) # def call_later(*args) self::PublisherJob.perform_later(*args) + end + + # Like `call_later`, but performs at a given time + # @example Configuring a time to perform the job + # RecipePublisher.call_later_at(Date.tomorrow.noon, Recipe.find(1)) + # + def call_later_at(at, *args) + self::PublisherJob.set(wait_until: at).perform_later(*args) end private def inherited(subclass)