Module: KRPC::Doc
- Defined in:
- lib/krpc/doc.rb
Defined Under Namespace
Modules: SuffixMethods
Class Method Summary collapse
- .add_docstring_info(is_static, cls, method_name, service_name = "", procedure_name = "", param_names = [], param_types = [], param_default = [], return_type: nil, xmldoc: "") ⇒ Object
- .add_special_docstring_info(key, value) ⇒ Object
- .docstring_for_method(method_owner, method_name, is_print_xmldoc_summary = true) ⇒ Object
- .docstring_for_procedure(service_name, procedure_name, is_print_xmldoc_summary = true) ⇒ Object
Class Method Details
.add_docstring_info(is_static, cls, method_name, service_name = "", procedure_name = "", param_names = [], param_types = [], param_default = [], return_type: nil, xmldoc: "") ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/krpc/doc.rb', line 32 def add_docstring_info(is_static, cls, method_name, service_name="", procedure_name="", param_names=[], param_types=[], param_default=[], return_type: nil, xmldoc: "") service_module_name = service_name == cls.class_name ? Services.class_name : service_name key0 = [service_name, procedure_name].hash key1 = [service_module_name, false, cls.class_name, method_name].hash val = [cls.krpc_name, calc_separator(is_static), method_name, param_names, param_types, param_default, return_type, xmldoc] @docstr_infos[key1] = @procedure_docstr_infos[key0] = val if is_static key2 = [service_module_name, true, cls.class_name, method_name].hash @docstr_infos[key2] = val end end |
.add_special_docstring_info(key, value) ⇒ Object
44 45 46 |
# File 'lib/krpc/doc.rb', line 44 def add_special_docstring_info(key, value) @docstr_infos[key] = value end |
.docstring_for_method(method_owner, method_name, is_print_xmldoc_summary = true) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/krpc/doc.rb', line 11 def docstring_for_method(method_owner, method_name, is_print_xmldoc_summary = true) is_static, class_cls = method_owner.class == Class ? [true, method_owner] : [false, method_owner.class] service_module_name, class_name = ruby_class_to_pb_module_class_pair(class_cls) key = [service_module_name, is_static, class_name, method_name.to_s].hash if @docstr_infos.has_key? key construct_docstring(*@docstr_infos[key], true, is_static, is_print_xmldoc_summary) else "No docstring for #{class_cls.name}#{calc_separator(is_static)}#{method_name.to_s} method" + (method_owner.respond_to?(method_name) ? "" : "\nThere is no such method -- maybe a typo?") end end |
.docstring_for_procedure(service_name, procedure_name, is_print_xmldoc_summary = true) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/krpc/doc.rb', line 23 def docstring_for_procedure(service_name, procedure_name, is_print_xmldoc_summary = true) key = [service_name, procedure_name].hash if @procedure_docstr_infos.has_key? key construct_docstring(service_name, '.', procedure_name, *@procedure_docstr_infos[key][3..-1], false, false, is_print_xmldoc_summary) else "No docstring for #{service_name}.#{procedure_name} procedure" end end |