Class: GrpcReflection::FileDescriptor
- Inherits:
-
Object
- Object
- GrpcReflection::FileDescriptor
- Defined in:
- lib/grpc_reflection/file_descriptor.rb
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#descriptor_data ⇒ Object
readonly
Returns the value of attribute descriptor_data.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#service_and_method_names ⇒ Object
readonly
Returns the value of attribute service_and_method_names.
Instance Method Summary collapse
-
#initialize(descriptor_data) ⇒ FileDescriptor
constructor
A new instance of FileDescriptor.
- #set_service_and_method_names ⇒ Object
Constructor Details
#initialize(descriptor_data) ⇒ FileDescriptor
Returns a new instance of FileDescriptor.
10 11 12 13 14 15 16 17 18 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 10 def initialize(descriptor_data) @file_descriptor_proto = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) @descriptor_data = descriptor_data.b @filename = @file_descriptor_proto.name @dependency = @file_descriptor_proto.dependency || [] @service_and_method_names = {} set_service_and_method_names end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
8 9 10 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 8 def dependency @dependency end |
#descriptor_data ⇒ Object (readonly)
Returns the value of attribute descriptor_data.
8 9 10 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 8 def descriptor_data @descriptor_data end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 8 def filename @filename end |
#service_and_method_names ⇒ Object (readonly)
Returns the value of attribute service_and_method_names.
8 9 10 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 8 def service_and_method_names @service_and_method_names end |
Instance Method Details
#set_service_and_method_names ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/grpc_reflection/file_descriptor.rb', line 20 def set_service_and_method_names @file_descriptor_proto.service.each do |s| converted_service = JSON.parse(s.to_json) @service_and_method_names[@file_descriptor_proto.package + "." + converted_service["name"]] = true converted_service["method"].each do |m| @service_and_method_names[@file_descriptor_proto.package + "." + converted_service["name"] + "." + m["name"]] = true end end end |