Class: Mediate::PostrequestBehavior Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/mediate/postrequest_behavior.rb

Overview

This class is abstract.

override #handle to implement

Abstract base class of a pipeline behavior that processes a request after the RequestHandler finishes.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles(request_class = Mediate::Request, mediator = Mediate.mediator) ⇒ void

This method returns an undefined value.

Registers this behavior to handle requests of the given type.

Parameters:

  • request_class (Class) (defaults to: Mediate::Request)

    the type of requests to handle (should inherit from Mediate::Request)

  • mediator (Mediate::Mediator) (defaults to: Mediate.mediator)

    the Mediator instance to register to

Raises:

  • (ArgumentError)

    if request_class does not inherit from Mediate::Request



20
21
22
# File 'lib/mediate/postrequest_behavior.rb', line 20

def self.handles(request_class = Mediate::Request, mediator = Mediate.mediator)
  mediator.register_postrequest_behavior(self, request_class)
end

Instance Method Details

#handle(_request, _result) ⇒ void

This method is abstract.

This method returns an undefined value.

The method that handles the request and the result that the handler returned.

Parameters:

  • _request (Mediate::Request)
  • _result

    what was returned by the RequestHandler

Raises:

  • (NoMethodError)


34
35
36
# File 'lib/mediate/postrequest_behavior.rb', line 34

def handle(_request, _result)
  raise NoMethodError, "handle must be implemented"
end