Sha256: 01a83b33c8a31cc6945c9173111d81ea40b3fc90170da967be6269b82117c92f

Contents?: true

Size: 472 Bytes

Versions: 2

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift(File.expand_path("../../lib", __dir__))
require "dev_suite"

# Create a conditional workflow
engine = DevSuite::Workflow::Engine.new(user: "Bob", role: "admin")

# Add a conditional step
conditional_step = DevSuite::Workflow.create_conditional_step("Admin Greeting", ->(ctx) {
  ctx.get(:role) == "admin"
}) do |context|
  puts "Welcome Admin, #{context.get(:user)}!"
end

engine.add_step(conditional_step)
engine.execute

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dev_suite-0.2.9 examples/workflow/conditional_workflow.rb
dev_suite-0.2.8 examples/workflow/conditional_workflow.rb