class Zenaton::Interfaces::Workflow

@abstract Subclass and override {#handle} to implement a custom Workflow

Public Instance Methods

add_context(**attributes) click to toggle source

@private Sets a new context if none has been set yet. This is called from the zenaton agent and will raise if called twice. @raise [ArgumentError] when the context was already set.

# File lib/zenaton/interfaces/workflow.rb, line 32
def add_context(**attributes)
  raise ArgumentError if @context
  @context = Contexts::Workflow.new(attributes)
end
context() click to toggle source

@return [Zenaton::Contexts::Workflow] the workflow execution context

# File lib/zenaton/interfaces/workflow.rb, line 24
def context
  @context || Contexts::Workflow.new
end
handle() click to toggle source

Method called to run the workflow

# File lib/zenaton/interfaces/workflow.rb, line 11
def handle
  raise NotImplemented,
        "Your workflow does not implement the `handle' method"
end
id() click to toggle source

(Optional) Implement this method if you want to use custom IDs for your workflows. @return [String, Integer, NilClass] the custom id. Must be <= 256 bytes.

# File lib/zenaton/interfaces/workflow.rb, line 19
def id
  nil
end