mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
Fixes for ruby server code gen
Reviewed By: tbr-doug git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
79e41b817e
commit
da748dd5fe
@ -413,6 +413,7 @@ void t_rb_generator::generate_rb_struct_reader(ofstream& out,
|
||||
indent() << "else" << endl <<
|
||||
indent() << " iprot.skip(ftype)" << endl <<
|
||||
indent() << "end" << endl;
|
||||
indent_down();
|
||||
}
|
||||
|
||||
// In the default case we skip the field
|
||||
@ -785,7 +786,7 @@ void t_rb_generator::generate_service_server(t_service* tservice) {
|
||||
}
|
||||
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
|
||||
f_service_ <<
|
||||
indent() << "@processMap[\"" << (*f_iter)->get_name() << "\"] = Processor.process_" << (*f_iter)->get_name() << endl;
|
||||
indent() << "@processMap['" << (*f_iter)->get_name() << "'] = method(:process_" << (*f_iter)->get_name() << ")" << endl;
|
||||
}
|
||||
indent_down();
|
||||
indent(f_service_) << "end" << endl << endl;
|
||||
@ -805,7 +806,7 @@ void t_rb_generator::generate_service_server(t_service* tservice) {
|
||||
indent() << "if (@processMap.has_key?(name))" << endl <<
|
||||
indent() << " @processMap[name].call(seqid, iprot, oprot)" << endl <<
|
||||
indent() << "else" << endl <<
|
||||
indent() << " print 'Unknown function %s' % (name)" << endl <<
|
||||
indent() << " print \"Unknown function #{name}\"" << endl <<
|
||||
indent() << "end" << endl;
|
||||
|
||||
// Read end of args field, the T_STOP, and the struct close
|
||||
@ -837,11 +838,11 @@ void t_rb_generator::generate_process_function(t_service* tservice,
|
||||
"(seqid, iprot, oprot)" << endl;
|
||||
indent_up();
|
||||
|
||||
string argsname = tfunction->get_name() + "_args";
|
||||
string resultname = tfunction->get_name() + "_result";
|
||||
string argsname = capitalize(tfunction->get_name()) + "_args";
|
||||
string resultname = capitalize(tfunction->get_name()) + "_result";
|
||||
|
||||
f_service_ <<
|
||||
indent() << "args = " << argsname << "()" << endl <<
|
||||
indent() << "args = " << argsname << ".new()" << endl <<
|
||||
indent() << "args.read(iprot)" << endl <<
|
||||
indent() << "iprot.readMessageEnd()" << endl;
|
||||
|
||||
@ -852,7 +853,7 @@ void t_rb_generator::generate_process_function(t_service* tservice,
|
||||
// Declare result for non async function
|
||||
if (!tfunction->is_async()) {
|
||||
f_service_ <<
|
||||
indent() << "result = " << resultname << "()" << endl;
|
||||
indent() << "result = " << resultname << ".new()" << endl;
|
||||
}
|
||||
|
||||
// Try block for a function with exceptions
|
||||
|
Loading…
Reference in New Issue
Block a user