Method: RDoc::Parser::C#do_aliases

Defined in:
lib/rdoc/parser/c.rb

#do_aliasesObject

Scans #content for rb_define_alias



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/rdoc/parser/c.rb', line 222

def do_aliases
  @content.scan(/rb_define_alias\s*\(
                 \s*(\w+),
                 \s*"(.+?)",
                 \s*"(.+?)"
                 \s*\)/xm) do |var_name, new_name, old_name|
    class_name = @known_classes[var_name]

    unless class_name then
      @options.warn "Enclosing class or module %p for alias %s %s is not known" % [
        var_name, new_name, old_name]
      next
    end

    class_obj = find_class var_name, class_name
    comment = find_alias_comment var_name, new_name, old_name
    comment.normalize
    if comment.to_s.empty? and existing_method = class_obj.method_list.find { |m| m.name == old_name}
      comment = existing_method.comment
    end
    add_alias(var_name, class_obj, old_name, new_name, comment)
  end
end