Skip to content
This repository was archived by the owner on Aug 16, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions gems/operation/2.0/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down