module Zenaton::Traits::Zenatonable

Module to be included in tasks and workflows

Public Instance Methods

dispatch() click to toggle source

Sends self as the single job to be dispatched to the engine and returns the result

# File lib/zenaton/traits/zenatonable.rb, line 21
def dispatch
  Engine.instance.dispatch([self])
end
execute() click to toggle source

Sends self as the single job to be executed to the engine and returns the result

# File lib/zenaton/traits/zenatonable.rb, line 15
def execute
  Engine.instance.execute([self])[0]
end
schedule(cron) click to toggle source

Sets the repeatable frequency of execution of a given job

# File lib/zenaton/traits/zenatonable.rb, line 26
def schedule(cron)
  if !cron.is_a?(String) || cron.blank?
    raise InvalidArgumentError,
          "The cron passed to 'schedule' must be a non empty string"
  end

  Engine.instance.schedule([self], cron)
end
where_id(id) click to toggle source

Search for workflows to interact with. For available methods, see {Zenaton::Query::Builder} @param id [String] (Optional) ID for a given worflow @return [Zenaton::Query::Builder] a query builder object

# File lib/zenaton/traits/zenatonable.rb, line 40
def where_id(id)
  Query::Builder.new(self).where_id(id)
end