Class: ProtobufDescriptor::MethodDescriptor

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasParent

#compute_source_code_info_path, #file_descriptor, #leading_comments, #protobuf_descriptor, #source_code_info_location, #source_code_info_locations, #source_code_info_span, #trailing_comments

Constructor Details

#initialize(parent, method_descriptor_proto) ⇒ MethodDescriptor

Returns a new instance of MethodDescriptor.



14
15
16
17
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 14

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



12
13
14
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 12

def method_descriptor_proto
  @method_descriptor_proto
end

#parentObject (readonly)

The parent ServiceDescriptor



9
10
11
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 9

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.



31
32
33
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 31

def input_type_name
  method_descriptor_proto.input_type
end

#nameObject

The name of the service method



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

def name
  method_descriptor_proto.name
end

#optionsObject

The +MethodOptions+ for the service method



25
26
27
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 25

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.



37
38
39
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 37

def output_type_name
  method_descriptor_proto.output_type
end

#resolve_input_typeObject

Resolves the method's +input_type_name+, returning the ProtobufDescriptor::MessageDescriptor that this method receives.



43
44
45
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 43

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 ProtobufDescriptor::MessageDescriptor that this method returns.



50
51
52
# File 'lib/protobuf_descriptor/method_descriptor.rb', line 50

def resolve_output_type
  protobuf_descriptor.resolve_type_name(output_type_name, file_descriptor)
end