Skip to content

Instantly share code, notes, and snippets.

@fernandes
Created July 13, 2019 16:11
Show Gist options
  • Save fernandes/c1b13e8fa022b0599055acd0e860db55 to your computer and use it in GitHub Desktop.
Save fernandes/c1b13e8fa022b0599055acd0e860db55 to your computer and use it in GitHub Desktop.
Trailcrazer
class Dummy3 < Trailcrazer::Operation
step :one
step :two, StepTwo
# can be a block (pay attention to use {} and not do/end)
define_step :one, ->(ctx : Trailcrazer::Context, params : OperationType) {
ctx[:sum] = params[:initial] + 4
true
}
# or a Class (inherit Trailcrazer::Step)
class StepTwo < Trailcrazer::Step
def run(ctx : Trailcrazer::Context, params : OperationType)
ctx[:final] = ctx[:sum] + 6
true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment