Class: Porch::ExecutableStepDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/porch/executable_step_decorator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step, organizer) ⇒ ExecutableStepDecorator

Returns a new instance of ExecutableStepDecorator.



13
14
15
# File 'lib/porch/executable_step_decorator.rb', line 13

def initialize(step, organizer)
  @decorated_step = decorate step, organizer
end

Instance Attribute Details

#decorated_stepObject (readonly)

Returns the value of attribute decorated_step.



7
8
9
# File 'lib/porch/executable_step_decorator.rb', line 7

def decorated_step
  @decorated_step
end

Class Method Details

.registered_decoratorsObject



26
27
28
# File 'lib/porch/executable_step_decorator.rb', line 26

def self.registered_decorators
  [ClassStepDecorator, MethodStepDecorator, ProcStepDecorator].freeze
end

Instance Method Details

#execute(context) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/porch/executable_step_decorator.rb', line 17

def execute(context)
  begin
    decorated_step.execute context
  rescue Porch::ContextStoppedError => e
    # this exception is just used for flow control
    e.context
  end
end

#stepObject



9
10
11
# File 'lib/porch/executable_step_decorator.rb', line 9

def step
  decorated_step.step
end