lib/openwfe/engine/engine.rb in openwferu-0.9.8 vs lib/openwfe/engine/engine.rb in openwferu-0.9.9

- old
+ new

@@ -134,33 +134,33 @@ # Returns a FlowExpressionId instance or a tuple FlowExpressionId / # Thread object if async is set to true. # def launch (launch_object, async=false) - launchitem = nil + launchitem = if launch_object.kind_of?(OpenWFE::LaunchItem) - if launch_object.kind_of? OpenWFE::LaunchItem + launch_object - launchitem = launch_object + elsif launch_object.kind_of?(Class) - elsif launch_object.kind_of? Class + LaunchItem.new launch_object - launchitem = LaunchItem.new(launch_object) - elsif launch_object.kind_of? String - launchitem = OpenWFE::LaunchItem.new + li = OpenWFE::LaunchItem.new - if launch_object[0] == '<' - launchitem.workflowDefinitionUrl = "field:__definition" - launchitem['definition'] = launch_object + if launch_object[0, 1] == '<' + li.workflowDefinitionUrl = "field:__definition" + li['definition'] = launch_object else - launchitem.workflowDefinitionUrl = launch_object + li.workflowDefinitionUrl = launch_object end + + li end - get_expression_pool.launch(launchitem, async) + get_expression_pool.launch launchitem, async end # # This method is used to feed a workitem back to the engine (after # it got sent to a worklist or wherever by a participant). @@ -168,14 +168,14 @@ # # This method also accepts LaunchItem instances. # def reply (workitem) - if workitem.kind_of? InFlowWorkItem + if workitem.kind_of?(InFlowWorkItem) get_expression_pool.reply(workitem.flow_expression_id, workitem) - elsif workitem.kind_of? LaunchItem + elsif workitem.kind_of?(LaunchItem) get_expression_pool.launch(workitem, false) else