Method: Trailblazer::Macro::Policy.step
- Defined in:
- lib/trailblazer/macro/policy.rb
.step(condition, name: nil, &block) ⇒ Object
Adds the ‘yield` result to the Railway and treats it like a policy-compatible object at runtime.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/trailblazer/macro/policy.rb', line 31 def self.step(condition, name: nil, &block) path = :"policy.#{name}.eval" task = Eval.new(name: name, path: path) injections = { Trailblazer::Activity::Railway.Inject() => { # :"policy.default.eval" path => ->(*) { condition } } } {task: task, id: path}.merge(injections) end |