Class: Taskr::Actions::Multi
- Inherits:
-
Object
- Object
- Taskr::Actions::Multi
- Includes:
- OpenWFE::Schedulable
- Defined in:
- lib/taskr/actions.rb
Overview
Do not extend this class. It is used internally to schedule multiple actions per task.
If you want to define your own custom Action, extend Taskr::Actions::Base
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#task ⇒ Object
Returns the value of attribute task.
Instance Method Summary collapse
-
#initialize ⇒ Multi
constructor
A new instance of Multi.
- #trigger(trigger_args = {}) ⇒ Object
Constructor Details
#initialize ⇒ Multi
Returns a new instance of Multi.
84 85 86 |
# File 'lib/taskr/actions.rb', line 84 def initialize self.actions = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
81 82 83 |
# File 'lib/taskr/actions.rb', line 81 def actions @actions end |
#task ⇒ Object
Returns the value of attribute task.
82 83 84 |
# File 'lib/taskr/actions.rb', line 82 def task @task end |
Instance Method Details
#trigger(trigger_args = {}) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/taskr/actions.rb', line 88 def trigger(trigger_args = {}) begin $LOG.info("Executing task #{self.name}") actions.each do |a| a.execute end # TODO: maybe we should store last_triggered time on a per-action basis? task.update_attribute(:last_triggered, Time.now) rescue => e $LOG.error(e) $LOG.debug("#{e.stacktrace}") task.update_attribute(:last_triggered, Time.now) task.update_attribute(:last_triggered_error, e) raise e end end |