Class: ProtobufDescriptor::ServiceDescriptor::MethodDescriptor

Inherits:
Object
  • Object
show all
Includes:
HasParent
Defined in:
lib/protobuf_descriptor/service_descriptor.rb

Overview

Describes a method of a service.

See MethodDescriptorProto

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasParent

#file_descriptor, #protobuf_descriptor

Constructor Details

#initialize(parent, method_descriptor_proto) ⇒ MethodDescriptor

Returns a new instance of MethodDescriptor.



22
23
24
25
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 22

def initialize(parent, method_descriptor_proto)
  @parent = parent
  @method_descriptor_proto = method_descriptor_proto
end

Instance Attribute Details

#method_descriptor_protoObject (readonly)

The MethodDescriptorProto this MethodDescriptor is wrapping



20
21
22
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 20

def method_descriptor_proto
  @method_descriptor_proto
end

#parentObject (readonly)

The parent ServiceDescriptor



17
18
19
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 17

def parent
  @parent
end

Instance Method Details

#input_type_nameObject

Input type name for the service method. This is resolved in the same way as FieldDescriptorProto.type_name, but must refer to a message type.



41
42
43
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 41

def input_type_name
  method_descriptor_proto.input_type
end

#nameObject

The name of the service method



30
31
32
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 30

def name
  method_descriptor_proto.name
end

#optionsObject

The MethodOptions for the service method



35
36
37
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 35

def options
  method_descriptor_proto.options
end

#output_type_nameObject

Output type name for the service method. This is resolved in the same way as FieldDescriptorProto.type_name, but must refer to a message type.



47
48
49
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 47

def output_type_name
  method_descriptor_proto.output_type
end

#resolve_input_typeObject

Resolves the method’s input_type_name, returning the MessageDescriptor that this method receives.



54
55
56
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 54

def resolve_input_type
  protobuf_descriptor.resolve_type_name(input_type_name, file_descriptor)
end

#resolve_output_typeObject

Resolves the method’s output_type_name, returning the MessageDescriptor that this method returns.



61
62
63
# File 'lib/protobuf_descriptor/service_descriptor.rb', line 61

def resolve_output_type
  protobuf_descriptor.resolve_type_name(output_type_name, file_descriptor)
end