Sha256: 03fdfc9d0a11a92a1bc6cdb8f623579e88d5946cf4ff610454c694601e4cae0a
Contents?: true
Size: 869 Bytes
Versions: 6
Compression:
Stored size: 869 Bytes
Contents
module Apidiesel module Handlers def request_handlers @request_handlers ||= [] end def response_handlers @response_handlers ||= [] end def exception_handlers @exception_handlers ||= [] end # Registers a handler for requests, responses and/or exceptions # # @param [Class] klass def use(klass, *args, &block) request_handler = "#{klass.name}::RequestHandler".safe_constantize response_handler = "#{klass.name}::ResponseHandler".safe_constantize exception_handler = "#{klass.name}::ExceptionHandler".safe_constantize request_handlers << request_handler.new(*args, &block) if request_handler response_handlers << response_handler.new(*args, &block) if response_handler exception_handlers << exception_handler.new(*args, &block) if exception_handler end end end
Version data entries
6 entries across 6 versions & 1 rubygems