Method: YARD::Handlers::C::HandlerMethods#handle_alias

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

#handle_alias(var_name, new_name, old_name) ⇒ Object

Since:

  • 0.8.0


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/yard/handlers/c/handler_methods.rb', line 62

def handle_alias(var_name, new_name, old_name)
  namespace = namespace_for_variable(var_name)
  return if namespace.nil?
  new_meth, old_meth = new_name.to_sym, old_name.to_sym
  old_obj = namespace.child(:name => old_meth, :scope => :instance)
  new_obj = register MethodObject.new(namespace, new_meth, :instance) do |o|
    register_visibility(o, visibility)
    register_file_info(o, statement.file, statement.line)
  end

  if old_obj
    new_obj.signature = old_obj.signature
    new_obj.source = old_obj.source
    new_obj.docstring = old_obj.docstring
    new_obj.docstring.object = new_obj
  else
    new_obj.signature = "def #{new_meth}" # this is all we know.
  end

  namespace.aliases[new_obj] = old_meth
end