Method: YARD::Handlers::C::HandlerMethods#handle_method

Defined in:
lib/yard/handlers/c/handler_methods.rb

#handle_method(scope, var_name, name, func_name, source_file = nil) ⇒ Object

Since:

  • 0.8.0


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/yard/handlers/c/handler_methods.rb', line 34

def handle_method(scope, var_name, name, func_name, source_file = nil)
  visibility = :public
  case scope
  when "singleton_method"; scope = :class
  when "module_function"; scope = :module
  when "private_method"; scope = :instance; visibility = :private
  else; scope = :instance
  end

  namespace = namespace_for_variable(var_name)
  return if namespace.nil? # XXX: raise UndocumentableError might be too noisy.
  register MethodObject.new(namespace, name, scope) do |obj|
    register_visibility(obj, visibility)
    find_method_body(obj, func_name)
    obj.docstring.add_tag(Tags::Tag.new(:return, '', 'Boolean')) if name =~ /\?$/
  end
end