diff --git a/gems/operation/2.0/api.md b/gems/operation/2.0/api.md index cbfee923..a7ae3a24 100644 --- a/gems/operation/2.0/api.md +++ b/gems/operation/2.0/api.md @@ -27,6 +27,20 @@ Ruby allows a shorthand for this which is commonly used throughout Trailblazer. The absence of a method name here is per design: this object does only one thing, and hence *what it does is reflected in the class name*. +Arguments passed to `call` will be available within steps (see below) under `options[:params]`: + + # within Song::Create: + step :log_name! + + def log_name!(options) + logger.write "creating song called #{options['params']['name']}" + end + + # alternatively with Ruby's double splat operator: + def log_name!(options, params:, **) + logger.write "creating song called #{params[:name]}" + end + Running an operation will always return its [→ result object](#result-object). It is up to you to interpret the content of it or push data onto the result object during the operation's cycle. result = Create.call( name: "Roxanne" )