Class: ProtoPlugin::MethodDescriptor
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ProtoPlugin::MethodDescriptor
- Defined in:
- lib/proto_plugin/method_descriptor.rb
Overview
A wrapper class around Google::Protobuf::MethodDescriptorProto
which provides helpers and more idiomatic Ruby access patterns.
Any method not defined directly is delegated to the descriptor the wrapper was initialized with.
Instance Attribute Summary collapse
- #descriptor ⇒ Google::Protobuf::MethodDescriptorProto readonly
-
#service ⇒ ServiceDescriptor
readonly
The service this method was defined in.
Instance Method Summary collapse
-
#bidirectional_streaming? ⇒ Boolean
Returns true if both the client and server may send multiple streamed messages.
-
#client_streaming? ⇒ Boolean
Returns true if the client may stream multiple client messages.
-
#initialize(descriptor, service) ⇒ MethodDescriptor
constructor
A new instance of MethodDescriptor.
-
#server_streaming? ⇒ Boolean
Returns true if the server may stream multiple server messages.
-
#unary? ⇒ Boolean
Returns true if both the client and server only may send single messages.
Constructor Details
#initialize(descriptor, service) ⇒ MethodDescriptor
Returns a new instance of MethodDescriptor.
23 24 25 26 27 |
# File 'lib/proto_plugin/method_descriptor.rb', line 23 def initialize(descriptor, service) super(descriptor) @descriptor = descriptor @service = service end |
Instance Attribute Details
#descriptor ⇒ Google::Protobuf::MethodDescriptorProto (readonly)
14 15 16 |
# File 'lib/proto_plugin/method_descriptor.rb', line 14 def descriptor @descriptor end |
#service ⇒ ServiceDescriptor (readonly)
The service this method was defined in.
19 20 21 |
# File 'lib/proto_plugin/method_descriptor.rb', line 19 def service @service end |
Instance Method Details
#bidirectional_streaming? ⇒ Boolean
Returns true if both the client and server may send multiple streamed messages.
53 54 55 |
# File 'lib/proto_plugin/method_descriptor.rb', line 53 def bidirectional_streaming? client_streaming? && server_streaming? end |
#client_streaming? ⇒ Boolean
Returns true if the client may stream multiple client messages.
32 33 34 |
# File 'lib/proto_plugin/method_descriptor.rb', line 32 def client_streaming? descriptor.client_streaming end |
#server_streaming? ⇒ Boolean
Returns true if the server may stream multiple server messages.
39 40 41 |
# File 'lib/proto_plugin/method_descriptor.rb', line 39 def server_streaming? descriptor.server_streaming end |
#unary? ⇒ Boolean
Returns true if both the client and server only may send single messages.
46 47 48 |
# File 'lib/proto_plugin/method_descriptor.rb', line 46 def unary? !client_streaming? && !server_streaming? end |