Module: Trailblazer::Operation::Nested
- Defined in:
- lib/trailblazer/operation/nested.rb
Defined Under Namespace
Class Method Summary collapse
-
.for(step, input, output) ⇒ Object
Please note that the instance_variable_get are here on purpose since the superinternal API is not entirely decided, yet.
Class Method Details
.for(step, input, output) ⇒ Object
Please note that the instance_variable_get are here on purpose since the superinternal API is not entirely decided, yet.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/trailblazer/operation/nested.rb', line 25 def self.for(step, input, output) # DISCUSS: use builders here? invoker = Caller::Dynamic.new(step) invoker = Caller.new(step) if step.is_a?(Class) && step <= Trailblazer::Operation # interestingly, with < we get a weird nil exception. bug in Ruby? = Options.new = Options::Dynamic.new(input) if input = Options::Output.new = Options::Output::Dynamic.new(output) if output # This lambda is the strut added on the track, executed at runtime. ->(operation, ) do result = invoker.(operation, , .(operation, )) # TODO: what about containers? .(operation, , result).each { |k,v| [k] = v } result.success? # DISCUSS: what if we could simply return the result object here? end end |