diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index b697de63d15..b3e19386c80 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/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);