t_list* tlist,
std::string iter);
+ void generate_rdoc (std::ofstream& out,
+ t_doc* tdoc);
+
/**
* Helper rendering functions
*/
* Generates a ruby struct
*/
void t_rb_generator::generate_rb_struct(std::ofstream& out, t_struct* tstruct, bool is_exception = false) {
+ generate_rdoc(out, tstruct);
indent(out) << "class " << type_name(tstruct);
if (is_exception) {
out << " < StandardError";
}
- out << endl;
+ out << endl;
indent_up();
indent(out) << "include Thrift::Struct" << endl;
out << "," << endl;
}
+ // generate the field docstrings within the FIELDS constant. no real better place...
+ generate_rdoc(out, *f_iter);
+
indent(out) <<
upcase_string((*f_iter)->get_name()) << " => ";
}
+void t_rb_generator::generate_rdoc(std::ofstream& out, t_doc* tdoc) {
+ if (tdoc->has_doc()) {
+ generate_docstring_comment(out,
+ "", "# ", tdoc->get_doc(), "");
+ }
+}
+
THRIFT_REGISTER_GENERATOR(rb, "Ruby", "");