Method: KRPC::Doc.docstring_for_method

Defined in:
lib/krpc/doc.rb

.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