Module: Gritz::Compat::Gruf

Defined in:
/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb,
/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf/config_converter.rb

Overview

Selected Gruf 2.22 controller/interceptor APIs, without loading Gruf or grpc.

Defined Under Namespace

Modules: ErrorHelpers Classes: ActiveCall, ConfigConverter, Controller, Error, Request, RequestContext, ServerInterceptor

Constant Summary collapse

REQUEST_KEY =
Object.new.freeze
Base =
Controller

Class Method Summary collapse

Class Method Details

.interceptor(klass) ⇒ Class

Wraps a Gruf-style interceptor as a Gritz server middleware.

Parameters:

  • klass (Class) —

    interceptor implementing #call and yielding to the action

Returns:

  • (Class) —

    middleware accepted by Middleware::Stack#use



22
23
24
25
26
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 22

def self.interceptor(klass)
  Class.new(InterceptorAdapter) do
    define_method(:initialize) { |app, **options| super(app, klass, options) }
  end
end