Sha256: 2ad472bc75ada561fc3638e9126367d2cfc1320e87531a684459c2ff143312c1

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

module WipeOut
  # Executes plan for a given record.
  # Plan execution flow:
  #   - emit event: `#before_plan`
  #
  # For each record (recursively, depth first)
  #   - emit event: `#before_execution`
  #   - emit event: `#after_execution`
  #
  # After plan had been executed (won't run if exception had been raised)
  #   - emit event: `#after_plan`
  #
  # To see how plan is defined, see {Plans::Dsl}
  # To configure, see {Config}
  #
  class Execute
    method_object :plan, :ar_class, :record

    def call
      ar_class.transaction do
        execution = Execution::Context.new(plan, record)

        execution.notify(:before_plan)

        Execution::ExecutePlan.call(execution)

        execution.notify(:after_plan)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wipe_out-1.1.0 lib/wipe_out/execute.rb
wipe_out-1.0.1 lib/wipe_out/execute.rb
wipe_out-1.0.0 lib/wipe_out/execute.rb