Class: LightService::Organizer::WithCallback
- Inherits:
-
Object
- Object
- LightService::Organizer::WithCallback
- Extended by:
- ScopedReducable
- Defined in:
- lib/light-service/organizer/with_callback.rb
Class Method Summary collapse
Methods included from ScopedReducable
Class Method Details
.run(organizer, action, steps) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/light-service/organizer/with_callback.rb', line 6 def self.run(organizer, action, steps) lambda do |ctx| return ctx if ctx.stop_processing? # This will only allow 2 level deep nesting of callbacks previous_callback = ctx[:callback] ctx[:callback] = lambda do |context| ctx = scoped_reduce(organizer, context, steps) ctx end ctx = action.execute(ctx) ctx[:callback] = previous_callback ctx end end |