Class: Browserctl::WorkflowDefinition
- Inherits:
-
CallableDefinition
- Object
- CallableDefinition
- Browserctl::WorkflowDefinition
- Defined in:
- lib/browserctl/workflow.rb
Instance Attribute Summary
Attributes inherited from CallableDefinition
#description, #name, #param_defs, #steps
Instance Method Summary collapse
- #call(params, client, replay_context: nil) ⇒ Object
- #callable_kind ⇒ Object
-
#compose(workflow_name) ⇒ Object
Definition-time guard: composing a flow into a workflow would copy flow steps that may close over ‘page` (a flow-only DSL) into a context that doesn’t expose it.
Methods inherited from CallableDefinition
#desc, #initialize, #param, #step
Constructor Details
This class inherits a constructor from Browserctl::CallableDefinition
Instance Method Details
#call(params, client, replay_context: nil) ⇒ Object
337 338 339 340 |
# File 'lib/browserctl/workflow.rb', line 337 def call(params, client, replay_context: nil) ctx = WorkflowContext.new(resolve_params(params), client, replay_context: replay_context) execute_steps(ctx) end |
#callable_kind ⇒ Object
312 313 314 |
# File 'lib/browserctl/workflow.rb', line 312 def callable_kind :workflow end |
#compose(workflow_name) ⇒ Object
Definition-time guard: composing a flow into a workflow would copy flow steps that may close over ‘page` (a flow-only DSL) into a context that doesn’t expose it. Cross-kind composition is rejected here rather than failing later inside an ‘instance_exec`.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/browserctl/workflow.rb', line 320 def compose(workflow_name) name = workflow_name.to_s if Browserctl.lookup_flow(name) raise Browserctl::Error.new( "workflow '#{@name}' cannot compose flow '#{name}': flows return state, " \ "workflows share state — composition across kinds is not supported", code: Browserctl::Error::Codes::INVALID_DSL_USAGE, context: { workflow: @name, flow: name, kind: :cross_kind_compose } ) end source = Browserctl.lookup_workflow(name) raise WorkflowError, "workflow '#{workflow_name}' not found for composition" unless source @steps.concat(source.steps) end |