Ruby protoc plugin fix: fix test breakage

pull/23501/head
Stanley Cheung 5 years ago
parent 0f34ccbfa8
commit cdf1070c9b
  1. 6
      src/compiler/ruby_generator_string-inl.h

@ -118,10 +118,10 @@ inline std::string RubyPackage(const grpc::protobuf::FileDescriptor* file) {
// RubyTypeOf updates a proto type to the required ruby equivalent.
inline std::string RubyTypeOf(const grpc::protobuf::Descriptor* descriptor) {
std::string proto_type = descriptor->full_name();
ReplacePrefix(&proto_type, descriptor->file()->package(),
""); // remove the leading package if present
ReplacePrefix(&proto_type, ".", ""); // remove the leading . (no package)
if (descriptor->file()->options().has_ruby_package()) {
// remove the leading package if present
ReplacePrefix(&proto_type, descriptor->file()->package(), "");
ReplacePrefix(&proto_type, ".", ""); // remove the leading . (no package)
proto_type = RubyPackage(descriptor->file()) + "." + proto_type;
}
std::string res(proto_type);

Loading…
Cancel
Save