Class: ProtoPlugin::ServiceDescriptor
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ProtoPlugin::ServiceDescriptor
- Defined in:
- lib/proto_plugin/service_descriptor.rb
Overview
A wrapper class around Google::Protobuf::ServiceDescriptorProto
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::ServiceDescriptorProto readonly
-
#parent ⇒ FileDescriptor
readonly
The file this service was defined within.
Instance Method Summary collapse
-
#full_name ⇒ String
The full name of the service, including parent namespace.
-
#initialize(descriptor, parent) ⇒ ServiceDescriptor
constructor
A new instance of ServiceDescriptor.
-
#rpc_methods ⇒ Array<MethodDescriptor>
The methods defined for the service.
Constructor Details
#initialize(descriptor, parent) ⇒ ServiceDescriptor
Returns a new instance of ServiceDescriptor.
23 24 25 26 27 |
# File 'lib/proto_plugin/service_descriptor.rb', line 23 def initialize(descriptor, parent) super(descriptor) @descriptor = descriptor @parent = parent end |
Instance Attribute Details
#descriptor ⇒ Google::Protobuf::ServiceDescriptorProto (readonly)
14 15 16 |
# File 'lib/proto_plugin/service_descriptor.rb', line 14 def descriptor @descriptor end |
#parent ⇒ FileDescriptor (readonly)
The file this service was defined within.
19 20 21 |
# File 'lib/proto_plugin/service_descriptor.rb', line 19 def parent @parent end |
Instance Method Details
#full_name ⇒ String
The full name of the service, including parent namespace.
35 36 37 |
# File 'lib/proto_plugin/service_descriptor.rb', line 35 def full_name @full_name ||= "#{parent.namespace}::#{name}" end |
#rpc_methods ⇒ Array<MethodDescriptor>
Note:
This method is named rpc_methods
to avoid conflicting with Object#methods.
The methods defined for the service.
47 48 49 50 51 |
# File 'lib/proto_plugin/service_descriptor.rb', line 47 def rpc_methods @rpc_methods ||= @descriptor["method"].map do |m| MethodDescriptor.new(m, self) end end |