class Gruf::Outbound::RequestContext
Encapsulates the context of an outbound client request
Attributes
call[R]
@var [GRPC::ActiveCall]
metadata[R]
@var [Hash] metadata
method[R]
@var [Method] method
requests[R]
@var [Enumerable] requests
type[R]
@var [Symbol]
Public Class Methods
new(type:, requests:, call:, method:, metadata:)
click to toggle source
Initialize the new request context
@param [Symbol] type The type of request @param [Enumerable] requests An enumerable of requests being sent @param [GRPC::ActiveCall] call The GRPC
ActiveCall object @param [Method] method The method being called @param [Hash] metadata A hash of outgoing metadata
# File lib/gruf/outbound/request_context.rb, line 44 def initialize(type:, requests:, call:, method:, metadata:) @type = type @requests = requests @call = call @method = method @metadata = metadata end
Public Instance Methods
method_name()
click to toggle source
Return the name of the method being called, e.g. GetThing
@return [String]
# File lib/gruf/outbound/request_context.rb, line 57 def method_name @method.to_s.split('/').last end
route_key()
click to toggle source
Return the proper routing key for the request
@return [String]
# File lib/gruf/outbound/request_context.rb, line 66 def route_key @method[1..].underscore.tr('/', '.') end