Class: Gruf::Outbound::RequestContext
- Inherits:
-
Object
- Object
- Gruf::Outbound::RequestContext
- Defined in:
- lib/gruf/outbound/request_context.rb
Overview
Encapsulates the context of an outbound client request
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, requests:, call:, method:, metadata:) ⇒ RequestContext
constructor
Initialize the new request context.
-
#method_name ⇒ String
Return the name of the method being called, e.g.
-
#route_key ⇒ String
Return the proper routing key for the request.
Constructor Details
#initialize(type:, requests:, call:, method:, metadata:) ⇒ RequestContext
Initialize the new request context
42 43 44 45 46 47 48 |
# File 'lib/gruf/outbound/request_context.rb', line 42 def initialize(type:, requests:, call:, method:, metadata:) @type = type @requests = requests @call = call @method = method @metadata = end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
27 28 29 |
# File 'lib/gruf/outbound/request_context.rb', line 27 def call @call end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
31 32 33 |
# File 'lib/gruf/outbound/request_context.rb', line 31 def @metadata end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
29 30 31 |
# File 'lib/gruf/outbound/request_context.rb', line 29 def method @method end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
25 26 27 |
# File 'lib/gruf/outbound/request_context.rb', line 25 def requests @requests end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'lib/gruf/outbound/request_context.rb', line 23 def type @type end |
Instance Method Details
#method_name ⇒ String
Return the name of the method being called, e.g. GetThing
55 56 57 |
# File 'lib/gruf/outbound/request_context.rb', line 55 def method_name @method.to_s.split('/').last end |
#route_key ⇒ String
Return the proper routing key for the request
64 65 66 |
# File 'lib/gruf/outbound/request_context.rb', line 64 def route_key @method[1..-1].underscore.tr('/', '.') end |