class GRPC::InterceptionContext
Represents the context in which an interceptor runs. Used to provide an injectable mechanism for handling interception. This is an EXPERIMENTAL API.
Public Class Methods
Source
# File src/ruby/lib/grpc/generic/interceptors.rb, line 158 def initialize(interceptors = []) @interceptors = interceptors.dup end
@param interceptors [Array<GRPC::Interceptor>]
Public Instance Methods
Source
# File src/ruby/lib/grpc/generic/interceptors.rb, line 169 def intercept!(type, args = {}) return yield if @interceptors.none? i = @interceptors.pop return yield unless i i.send(type, **args) do if @interceptors.any? intercept!(type, args) do yield end else yield end end end
Intercept the call and fire out to interceptors in a FIFO execution. This is an EXPERIMENTAL API.
@param [Symbol] type The request type @param [Hash] args The arguments for the call