Sha256: c2cbd26ffcb678f6ddf3c1d815a6835631919429d9ab0f841d35c2ec1e4a7678

Contents?: true

Size: 1.68 KB

Versions: 3

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasJSendResult
        module Entities
          class Result
            module Plugins
              module HasJSendStatusAndAttributes
                module Entities
                  class Status
                    module Plugins
                      module CanBeChecked
                        class Middleware < MethodChainMiddleware
                          intended_for [
                            :success?,
                            :failure?,
                            :error?,
                            :not_success?,
                            :not_failure?,
                            :not_error?
                          ],
                            entity: :result

                          ##
                          # @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)
                            mark_as_checked = kwargs.fetch(:mark_as_checked) { true }

                            entity.internals.cache[:checked] = true if mark_as_checked

                            chain.next(*args, **Utils::Hash.except(kwargs, [:mark_as_checked]), &block)
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/middleware.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/middleware.rb
convenient_service-0.18.0 lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/middleware.rb