class LightService::Organizer::ReduceUntil

Public Class Methods

run(organizer, condition_block, steps) click to toggle source
# File lib/light-service/organizer/reduce_until.rb, line 6
def self.run(organizer, condition_block, steps)
  lambda do |ctx|
    return ctx if ctx.stop_processing?

    loop do
      ctx = scoped_reduce(organizer, ctx, steps)
      break if condition_block.call(ctx) || ctx.failure?
    end

    ctx
  end
end