44 if (
method->client_streaming()) {
45 input_type =
"stream(" + input_type +
")";
48 if (
method->server_streaming()) {
49 output_type =
"stream(" + output_type +
")";
51 std::map<std::string, std::string> method_vars =
ListToDict({
60 out->Print(method_vars,
"rpc :$mth.name$, $input.type$, $output.type$\n");
66 if (
service->method_count() == 0) {
71 std::map<std::string, std::string> module_vars =
ListToDict({
75 out->Print(module_vars,
"module $module.name$\n");
79 out->Print(
"class Service\n");
84 out->Print(
"include ::GRPC::GenericService\n");
86 out->Print(
"self.marshal_class_method = :encode\n");
87 out->Print(
"self.unmarshal_class_method = :decode\n");
88 std::map<std::string, std::string> pkg_vars =
90 out->Print(pkg_vars,
"self.service_name = '$service_full_name$'\n");
92 for (
int i = 0;
i <
service->method_count(); ++
i) {
99 out->Print(
"Stub = Service.rpc_stub_class\n");
125 bool next_upper =
true;
129 for (std::string::size_type
i = 0;
i <
name.size();
i++) {
130 if (
name[
i] ==
'_') {
156 if (
file->service_count() == 0) {
163 std::map<std::string, std::string> header_comment_vars =
ListToDict({
169 out.Print(
"# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
170 out.Print(header_comment_vars,
171 "# Source: $file.name$ for package '$file.package$'\n");
174 if (!leading_comments.empty()) {
175 out.Print(
"# Original file comments:\n");
176 out.PrintRaw(leading_comments.c_str());
180 out.Print(
"require 'grpc'\n");
184 std::map<std::string, std::string> dep_vars =
ListToDict({
188 out.Print(dep_vars,
"require '$dep.name$'\n");
192 std::vector<std::string>
modules =
Split(package_name,
'.');
194 std::map<std::string, std::string> module_vars =
ListToDict({
198 out.Print(module_vars,
"module $module.name$\n");
201 for (
int i = 0;
i <
file->service_count(); ++
i) {