Class: Nocode::StepsExecutor

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/nocode/steps_executor.rb

Overview

Class that knows how to execute a series of steps given a context.

Constant Summary collapse

NAME_KEY =
'name'
OPTIONS_KEY =
'options'
TYPE_KEY =
'type'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context:, steps:) ⇒ StepsExecutor

Returns a new instance of StepsExecutor.



18
19
20
21
22
23
# File 'lib/nocode/steps_executor.rb', line 18

def initialize(context:, steps:)
  @context = context
  @steps   = steps

  freeze
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



14
15
16
# File 'lib/nocode/steps_executor.rb', line 14

def context
  @context
end

#stepsObject (readonly)

Returns the value of attribute steps.



14
15
16
# File 'lib/nocode/steps_executor.rb', line 14

def steps
  @steps
end

Instance Method Details

#executeObject



25
26
27
28
29
30
31
# File 'lib/nocode/steps_executor.rb', line 25

def execute
  steps.each do |step|
    step_instance = make_step(step)

    execute_step(step_instance)
  end
end