diff options
Diffstat (limited to 'src/compiler/ruby_generator.cc')
-rw-r--r-- | src/compiler/ruby_generator.cc | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index 1501c3f3e0..02202568cb 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -55,17 +55,20 @@ namespace { // Prints out the method using the ruby gRPC DSL. void PrintMethod(const MethodDescriptor *method, const grpc::string &package, Printer *out) { - grpc::string input_type = RubyTypeOf(method->input_type()->full_name(), package); + grpc::string input_type = + RubyTypeOf(method->input_type()->full_name(), package); if (method->client_streaming()) { input_type = "stream(" + input_type + ")"; } - grpc::string output_type = RubyTypeOf(method->output_type()->full_name(), package); + grpc::string output_type = + RubyTypeOf(method->output_type()->full_name(), package); if (method->server_streaming()) { output_type = "stream(" + output_type + ")"; } - std::map<grpc::string, grpc::string> method_vars = - ListToDict({"mth.name", method->name(), "input.type", input_type, - "output.type", output_type, }); + std::map<grpc::string, grpc::string> method_vars = ListToDict({ + "mth.name", method->name(), "input.type", input_type, "output.type", + output_type, + }); out->Print(GetRubyComments(method, true).c_str()); out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n"); out->Print(GetRubyComments(method, false).c_str()); @@ -79,8 +82,9 @@ void PrintService(const ServiceDescriptor *service, const grpc::string &package, } // Begin the service module - std::map<grpc::string, grpc::string> module_vars = - ListToDict({"module.name", CapitalizeFirst(service->name()), }); + std::map<grpc::string, grpc::string> module_vars = ListToDict({ + "module.name", CapitalizeFirst(service->name()), + }); out->Print(module_vars, "module $module.name$\n"); out->Indent(); @@ -130,8 +134,9 @@ grpc::string GetServices(const FileDescriptor *file) { } // Write out a file header. - std::map<grpc::string, grpc::string> header_comment_vars = ListToDict( - {"file.name", file->name(), "file.package", file->package(), }); + std::map<grpc::string, grpc::string> header_comment_vars = ListToDict({ + "file.name", file->name(), "file.package", file->package(), + }); out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n"); out.Print(header_comment_vars, "# Source: $file.name$ for package '$file.package$'\n"); @@ -147,16 +152,18 @@ grpc::string GetServices(const FileDescriptor *file) { // Write out require statemment to import the separately generated file // that defines the messages used by the service. This is generated by the // main ruby plugin. - std::map<grpc::string, grpc::string> dep_vars = - ListToDict({"dep.name", MessagesRequireName(file), }); + std::map<grpc::string, grpc::string> dep_vars = ListToDict({ + "dep.name", MessagesRequireName(file), + }); out.Print(dep_vars, "require '$dep.name$'\n"); // Write out services within the modules out.Print("\n"); std::vector<grpc::string> modules = Split(file->package(), '.'); for (size_t i = 0; i < modules.size(); ++i) { - std::map<grpc::string, grpc::string> module_vars = - ListToDict({"module.name", CapitalizeFirst(modules[i]), }); + std::map<grpc::string, grpc::string> module_vars = ListToDict({ + "module.name", CapitalizeFirst(modules[i]), + }); out.Print(module_vars, "module $module.name$\n"); out.Indent(); } |