Module: Zenaton::Traits::Zenatonable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Zenaton::Tasks::Wait, Workflows::Version
- Defined in:
- lib/zenaton/traits/zenatonable.rb
Overview
Module to be included in tasks and workflows
Instance Method Summary collapse
-
#dispatch ⇒ Object
Sends self as the single job to be dispatched to the engine and returns the result.
-
#execute ⇒ Object
Sends self as the single job to be executed to the engine and returns the result.
- #schedule(cron) ⇒ Object
Instance Method Details
#dispatch ⇒ Object
Sends self as the single job to be dispatched to the engine and returns the result
21 22 23 |
# File 'lib/zenaton/traits/zenatonable.rb', line 21 def dispatch Engine.instance.dispatch([self]) end |
#execute ⇒ Object
Sends self as the single job to be executed to the engine and returns the result
15 16 17 |
# File 'lib/zenaton/traits/zenatonable.rb', line 15 def execute Engine.instance.execute([self])[0] end |
#schedule(cron) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/zenaton/traits/zenatonable.rb', line 25 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 |