This page contains documentation for deprecated features of the activity
gem suite that have been superseded.
While everything described here is still working, we encourage you to slowly replace your old code with the functions we think are more useful, usually faster, plus better to debug and understand.
With trailblazer-2.1.1
and the bundled trailblazer-activity-dsl-linear-1.0.0
gems, the recommended way of I/O is using composable variable mapping via In()
and Out()
.
Before the introduction of the composable In()
, Out()
and Inject()
filters, variable mapping was done with the :input
and :output
option. This is still supported and not planned to be dropped. However, there are a bunch of drawbacks with using the monolithic, non-composable options.
:input
, :output
and :inject
option will overwrite any options set earlier (or later) via In()
, Out()
and Inject()
. This will often lead to problems when using macros.In()
approach can nicely display the computed set of variables going in or out of a step.:input
option.The :input
option accepts any callable following the option interface.
step :create_model,
input: :input_for_create_model
# becomes
In() => :input_for_create_model
:input
works identically to a single In()
call.
The :output
option, just like :input
, accepts any callable following the option interface.
step :create_model,
output: :output_for_create_model
# becomes
Out() => :output_for_create_model
:output
works identically to a single Out()
call.
The :output_with_outer_ctx
option is documented here.
step :create_model,
output: :output_for_create_model,
output_with_outer_ctx: true
# becomes
Out(with_outer_ctx: true) => :output_for_create_model
:inject
works identically to a single Inject()
call.
step :create_model,
inject: :inject_for_create_model
# becomes
Inject() => :inject_for_create_model
WIP: This section is not final, yet.
Very often your activity or one of the steps contained require particular objects and values to get their job done. Instead of hard-wiring those “dependencies” in the code it is good style to allow providing those objects by passing them into the activity at run-time. This is called dependency injection and is a common technique in software engineering.
One way for using dependency injection is using keyword arguments for variables you need, and defaulting those in the step signature.
TODO
TODO
defaulting in macros
In older versions before trailblazer-activity-dsl-linear-1.2.0
, connecting the Path()
to a separate terminus required you to pass two options :end_task
and :end_id
.
Output(...) => Path(
end_task: Activity::End.new(semantic: :valid),
end_id: "End.valid") do
# ...
end
This is now simplified to be more consistent by introducing the :terminus
option.
Output(...) => Path(terminus: :valid) do
# ...
end
If you haven’t updated your code you will see a deprecation warning.
[Trailblazer] <file.rb> Using `:end_task` and `:end_id` in Path() is deprecated, use `:terminus` instead.
Please refer to https://trailblazer.to/2.1/docs/activity.html#activity-wiring-api-path-end_task-end_id-deprecation