Class: GRPC::InterceptorRegistry

Inherits:
Object
  • Object
show all
Defined in:
src/ruby/lib/grpc/generic/interceptor_registry.rb

Overview

Represents a registry of added interceptors available for enumeration. The registry can be used for both server and client interceptors. This class is internal to gRPC and not meant for public usage.

Defined Under Namespace

Classes: DescendantError

Instance Method Summary collapse

Constructor Details

#initialize(interceptors = []) ⇒ InterceptorRegistry

Initialize the registry with an empty interceptor list This is an EXPERIMENTAL API.


33
34
35
36
37
38
39
40
41
42
# File 'src/ruby/lib/grpc/generic/interceptor_registry.rb', line 33

def initialize(interceptors = [])
  @interceptors = []
  interceptors.each do |i|
    base = GRPC::Interceptor
    unless i.class.ancestors.include?(base)
      fail DescendantError, "Interceptors must descend from #{base}"
    end
    @interceptors << i
  end
end

Instance Method Details

#build_contextInterceptionContext

Builds an interception context from this registry

Returns:


49
50
51
# File 'src/ruby/lib/grpc/generic/interceptor_registry.rb', line 49

def build_context
  InterceptionContext.new(@interceptors)
end