method
do_classes
v1_9_3_392 -
Show latest stable
- Class:
RDoc::Parser::C
do_classes()public
Scans #content for rb_define_module, rb_define_class, boot_defclass, rb_define_module_under, rb_define_class_under and rb_singleton_class
# File lib/rdoc/parser/c.rb, line 220
def do_classes
@content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/x) do
|var_name, class_name|
handle_class_module(var_name, "module", class_name, nil, nil)
end
# The '.' lets us handle SWIG-generated files
@content.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
\(
\s*"(\w+)",
\s*(\w+)\s*
\)/x) do |var_name, class_name, parent|
handle_class_module(var_name, "class", class_name, parent, nil)
end
@content.scan(/(\w+)\s*=\s*boot_defclass\s*\(\s*"(\w+?)",\s*(\w+?)\s*\)/) do
|var_name, class_name, parent|
parent = nil if parent == "0"
handle_class_module(var_name, "class", class_name, parent, nil)
end
@content.scan(/(\w+)\s* = \s*rb_define_module_under\s*
\(
\s*(\w+),
\s*"(\w+)"
\s*\)/x) do |var_name, in_module, class_name|
handle_class_module(var_name, "module", class_name, nil, in_module)
end
@content.scan(/([\w\.]+)\s* = # var_name
\s*rb_define_class_under\s*
\(
\s* (\w+), # under
\s* "(\w+)", # class_name
\s*
(?:
([\w\*\s\(\)\.\->]+) | # parent_name
rb_path2class\("([\w:]+)"\) # path
)
\s*
\)
/x) do |var_name, under, class_name, parent_name, path|
parent = path || parent_name
handle_class_module var_name, 'class', class_name, parent, under
end
@content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
\(
\s*(\w+)
\s*\)/x) do |sclass_var, class_var|
handle_singleton sclass_var, class_var
end
end Related methods
- Instance methods
- do_aliases
- do_attrs
- do_classes
- do_constants
- do_includes
- do_methods
- find_alias_comment
- find_attr_comment
- find_body
- find_class
- find_class_comment
- find_const_comment
- find_modifiers
- find_override_comment
- handle_attr
- handle_class_module
- handle_constants
- handle_ifdefs_in
- handle_method
- handle_singleton
- handle_tab_width
- look_for_directives_in
- rb_scan_args
- remove_commented_out_lines
- remove_private_comments
- scan
- Class methods
- new
- reset