Class: FunctionalLightService::Organizer::ReduceCase
- Extended by:
- ScopedReducable
- Defined in:
- lib/functional-light-service/organizer/reduce_case.rb
Defined Under Namespace
Classes: Arguments
Class Method Summary collapse
Methods included from ScopedReducable
Class Method Details
.run(organizer, **args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/functional-light-service/organizer/reduce_case.rb', line 34 def self.run(organizer, **args) arguments = Arguments.new(**args) ->(ctx) do return ctx if ctx.stop_processing? matched_case = arguments.when.keys.find { |k| k.eql?(ctx[arguments.value]) } steps = arguments.when[matched_case] || arguments.else ctx = scoped_reduce(organizer, ctx, steps) ctx end end |