Sha256: 5d232100e092a6f2c23806ccd2149c02409ab4b06a1fafef246ba7a62d6e5944

Contents?: true

Size: 730 Bytes

Versions: 5

Compression:

Stored size: 730 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: [] }
          @workflow[: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.17 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.16 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.15 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.14 lib/ad/agent_architecture/dsl/section_dsl.rb
ad-agent_architecture-0.0.13 lib/ad/agent_architecture/dsl/section_dsl.rb