Sha256: f5ed6c228a5c6f877f28bfcfa6163d65b54da51f5ac6989209b097c62fb1508c
Contents?: true
Size: 1.41 KB
Versions: 7
Compression:
Stored size: 1.41 KB
Contents
# -*- coding: utf-8 -*- module WorkflowKit module Factory def create_workflow workflow = Workflow.create( name: "Cook Spaghetti", description: "An example workflow to demonstrate how to use workflows in the `workflow_kit` gem." ) workflow.steps.create( brick_name: "BoilWaterBrick", parameters: { :aim_temperature => '100 °C' } ) workflow.steps.create( brick_name: "BoilSpaghettiBrick", parameters: { :time_to_boil => '10 minutes' } ) workflow.steps.create( brick_name: "ServeSpaghettiBrick" ) return workflow end end class BoilWaterBrick < Brick def description "Fill a large pot with water, put it on a cooker " + "and wait until the given temperature is reached." end def execute( params ) return self.description .gsub( "the given temperature", "a temperature of " + params[ :aim_temperature ] ) end end class BoilSpaghettiBrick < Brick def description "Add spaghetti and boil them for the given time." end def execute( params ) return self.description .gsub( "the given time", params[ :time_to_boil ] ) end end class ServeSpaghettiBrick < Brick def description "Sieve spaghetti, put them on a plate, and serve them with " + "some yummy ham-cheese-cream sauce." end def execute( params ) return self.description end end end
Version data entries
7 entries across 7 versions & 1 rubygems