Sha256: e2a89a0be32d14c2046faa3812a75c3cdf06e7ff7186ea147224f2f95973d087

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true

module LightServiceExt
  module AroundActionExecuteExtension
    def execute(context)
      return context if context.status == Status::COMPLETE
      self.before_execute_block.call(context)

      result = super(context.merge(invoked_action: self))

      context.merge!(result)
      context.fail! if result.errors.present?

      self.after_execute_block.call(context)
      self.after_success_block.call(context) if result.success?
      self.after_failure_block.call(context) if result.failure?
      result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
light-service-ext-0.1.11 lib/light-service-ext/around_action_execute_extension.rb