Sha256: 7c6ef262ae10f9f7af50b362928c4ff09a909fd361bef9713f0361541ff6ce62

Contents?: true

Size: 479 Bytes

Versions: 3

Compression:

Stored size: 479 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", condition: ->(ctx) {
  ctx.get(:role) == "admin"
}) do |context|
  puts "Welcome Admin, #{context.get(:user)}!"
end

engine.step(conditional_step)
engine.execute

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dev_suite-0.2.13 examples/workflow/conditional_workflow.rb
dev_suite-0.2.12 examples/workflow/conditional_workflow.rb
dev_suite-0.2.11 examples/workflow/conditional_workflow.rb