Class: Postjob::Registry::WorkflowSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/postjob/registry.rb

Defined Under Namespace

Classes: Options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow, options) ⇒ WorkflowSpec

Returns a new instance of WorkflowSpec.



129
130
131
132
133
# File 'lib/postjob/registry.rb', line 129

def initialize(workflow, options)
  expect! workflow => [ Module, String ]
  @workflow = workflow
  @options  = Options.new(options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



116
117
118
# File 'lib/postjob/registry.rb', line 116

def options
  @options
end

#workflowObject (readonly)

Returns the value of attribute workflow.



115
116
117
# File 'lib/postjob/registry.rb', line 115

def workflow
  @workflow
end

Instance Method Details

#nameObject



122
123
124
125
126
127
# File 'lib/postjob/registry.rb', line 122

def name
  case workflow
  when Module then workflow.name
  when String then workflow
  end
end

#runnable?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/postjob/registry.rb', line 118

def runnable?
  workflow.is_a?(Module)
end

#supports_cleanup?Boolean

Returns:

  • (Boolean)


135
136
137
138
139
140
# File 'lib/postjob/registry.rb', line 135

def supports_cleanup?
  return false unless lookup_workflow_method(:run)
  return false unless lookup_workflow_method(:cleanup)

  true
end