Class: GRPC::InterceptionContext
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/lib/grpc/generic/interceptors.rb
Overview
Represents the context in which an interceptor runs. Used to provide an injectable mechanism for handling interception. This is an EXPERIMENTAL API.
Instance Method Summary collapse
-
#initialize(interceptors = []) ⇒ InterceptionContext
constructor
A new instance of InterceptionContext.
-
#intercept!(type, args = {}) ⇒ Object
Intercept the call and fire out to interceptors in a FIFO execution.
Constructor Details
#initialize(interceptors = []) ⇒ InterceptionContext
Returns a new instance of InterceptionContext.
158 159 160 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/lib/grpc/generic/interceptors.rb', line 158 def initialize(interceptors = []) @interceptors = interceptors.dup end |
Instance Method Details
#intercept!(type, args = {}) ⇒ Object
Intercept the call and fire out to interceptors in a FIFO execution. This is an EXPERIMENTAL API.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/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 |