class Postjob::Registry::WorkflowSpec

Attributes

options[R]
workflow[R]

Public Class Methods

new(workflow, options) click to toggle source
# File lib/postjob/registry.rb, line 141
def initialize(workflow, options)
  expect! workflow => [ Module, String ]
  @workflow = workflow
  @options  = Options.new(options)
end

Public Instance Methods

name() click to toggle source
# File lib/postjob/registry.rb, line 134
def name
  case workflow
  when Module then workflow.name
  when String then workflow
  end
end
runnable?() click to toggle source
# File lib/postjob/registry.rb, line 130
def runnable?
  workflow.is_a?(Module)
end
supports_cleanup?() click to toggle source
# File lib/postjob/registry.rb, line 147
def supports_cleanup?
  return false unless lookup_workflow_method(:run)
  return false unless lookup_workflow_method(:cleanup)

  true
end

Private Instance Methods

lookup_workflow_method(name) click to toggle source
# File lib/postjob/registry.rb, line 156
def lookup_workflow_method(name)
  return unless workflow.is_a?(Module)
  workflow.method(name)
rescue NameError
  nil
end