Top Level Namespace

Defined Under Namespace

Modules: Scjson

Instance Method Summary collapse

Instance Method Details

#run_pending_finalizersObject

Execute any pending finalize blocks for completed invocations (only used when @defer_done)



1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
# File 'lib/scjson/engine/context.rb', line 1581

def run_pending_finalizers
  actions = []
  delta = {}
  @invocations.each do |iid, rec|
    next unless rec && rec[:status] == 'done'
    blocks = rec[:finalize_blocks]
    next unless blocks && !rec[:finalize_done]
    blocks.each do |fin|
      next unless fin.is_a?(Hash)
      a, d = run_actions_from_map(fin, context_state: rec[:state])
      actions.concat(a)
      delta.merge!(d)
    end
    rec[:finalize_done] = true
  end
  [actions, delta]
end