Sha256: e42535f6f864b792f573fc36e47f57ffe1846b1597781efd559feb26ecb079a4

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # This class is responsible for creating a section in the workflow
      class SectionDsl < ChildDsl
        def initialize(workflow, name, order)
          super(workflow)

          @section = { name: name, order: order, steps: [] }
          sections << @section
          @current_step_order = 1
        end

        def step(name, &block)
          raise ArgumentError, 'Step name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)

          StepDsl.new(workflow, @section, name, @current_step_order).instance_eval(&block)
          @current_step_order += 1
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.22 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.21 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.20 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.19 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.18 lib/ad/agent_architecture/dsl/section_dsl.rb