Sha256: caeb462bf4f787591119cff0fc35fcf0bb74db1f7a009ad43f8cdf224da9b0d8

Contents?: true

Size: 969 Bytes

Versions: 4

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          class Step
            module Plugins
              module RaisesOnNotResultReturnValue
                class Middleware < MethodChainMiddleware
                  include Support::DependencyContainer::Import

                  import :"commands.is_result?", from: ::ConvenientService::Service::Plugins::HasJSendResult::Container

                  intended_for any_method, entity: :step

                  def next(...)
                    original_result = chain.next(...)

                    return original_result if commands.is_result?(original_result)

                    ::ConvenientService.raise Exceptions::ReturnValueNotKindOfResult.new(step: entity, result: original_result)
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.18.0 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.17.0 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb