34 #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
35 #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
37 #include "src/compiler/config.h"
38 #include "src/compiler/ruby_generator_string-inl.h"
40 namespace grpc_ruby_generator {
42 inline bool ServicesFilename(
const grpc::protobuf::FileDescriptor *file,
43 grpc::string *file_name_or_error) {
45 static const unsigned proto_suffix_length = 6;
46 if (file->name().size() > proto_suffix_length &&
47 file->name().find_last_of(
".proto") == file->name().size() - 1) {
49 file->name().substr(0, file->name().size() - proto_suffix_length) +
53 *file_name_or_error =
"Invalid proto file name: must end with .proto";
58 inline grpc::string MessagesRequireName(
59 const grpc::protobuf::FileDescriptor *file) {
60 return Replace(file->name(),
".proto",
"");
65 #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H