Sha256: 1e988ad7ee58d263db6bffe4e8d572923cf86259b4a37bf8bcd8e19cd7482405

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          class Step
            module Plugins
              module CanHaveFallback
                class Middleware < MethodChainMiddleware
                  intended_for :result, entity: :step

                  ##
                  # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
                  #
                  def next(...)
                    result = chain.next(...)

                    return result unless entity.fallback_step?

                    return result if result.success?(mark_status_as_checked: false)

                    entity.fallback_result(...)
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.13.0 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/middleware.rb