Sha256: 0d27eb01451ecdf23bc425ad16c0a646a3249b99e0fc6a76f20642ebf94d8160

Contents?: true

Size: 836 Bytes

Versions: 7

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasJSendResultShortSyntax
        module Success
          class Middleware < MethodChainMiddleware
            intended_for :success, entity: :service

            ##
            # @param args [Array<Object>]
            # @param kwargs [Hash{Symbol => Object}]
            # @param block [Proc, nil]
            # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
            #
            def next(*args, **kwargs, &block)
              Commands::RefuteKwargsContainJSendAndExtraKeys[kwargs: kwargs]

              ([:data, :message, :code].any? { |key| kwargs.has_key?(key) }) ? chain.next(**kwargs) : chain.next(data: kwargs)
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.18.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.17.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.16.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.15.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb
convenient_service-0.14.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb