A deep exploration of 15 different Ruby idioms for declaring steps in a multi-step worker (transaction script) pattern. Starting from a simple manifest constant (STEPS array), the post walks through explicit DSLs, sugared DSL using `def` return values, naming conventions with `method_added`, block-step DSLs, step classes (Structs with #call), mixin chains, constant declarations with `const_added`, bound method lists, TracePoint hooks, and finally continuation-based approaches using Fibers, Enumerators, and the deprecated `callcc`. Each approach is shown with full code for both the subclass and the Steppa base class. The author recommends the plain manifest constant for application code and the explicit DSL for shared abstractions or gems, noting that options like `retry: false` make the DSL genuinely expressive.
Table of contents
The manifest #The explicit DSL #The sugared DSL #The naming convention #The block-step DSL #The step class #The mixin chain #The constant declaration #The bound method list #The TracePoint #Resuming from step 3 #The Fiber #The Enumerator #The exile (callcc) #Wrapping up #Sort: