diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/rdoc.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/parser/c.rb | 37 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_parser_c.rb | 36 |
5 files changed, 58 insertions, 24 deletions
@@ -1,3 +1,8 @@ +Mon May 16 08:00:05 2011 Eric Hodel <[email protected]> + + * lib/rdoc.rb: Update to RDoc 3.6.1, allows OpenSSL::Digest to be + found. + Mon May 16 05:49:54 2011 Eric Hodel <[email protected]> * lib/drb/acl.rb: Add documentation. @@ -108,7 +108,7 @@ with all sufficient information, see the ChangeLog file. * support for bash/zsh completion. * RDoc - * RDoc has been upgraded to RDoc 3.6. For full release notes see + * RDoc has been upgraded to RDoc 3.6.1. For full release notes see http://docs.seattlerb.org/rdoc/History_txt.html * rexml diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 6414bd7683..aee6da5049 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -103,7 +103,7 @@ module RDoc ## # RDoc version you are using - VERSION = '3.6' + VERSION = '3.6.1' ## # Method visibilities diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 0f2196b2e8..12efb407a2 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -218,13 +218,22 @@ class RDoc::Parser::C < RDoc::Parser handle_class_module(var_name, "module", class_name, nil, in_module) end - @content.scan(/([\w\.]+)\s* = \s*rb_define_class_under\s* - \( - \s*(\w+), - \s*"(\w+)", - \s*([\w\*\s\(\)\.\->]+)\s* # for SWIG - \s*\)/mx) do |var_name, in_module, class_name, parent| - handle_class_module(var_name, "class", class_name, parent, in_module) + @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* + \) + /mx) 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* @@ -650,8 +659,8 @@ class RDoc::Parser::C < RDoc::Parser enclosure = @classes[in_module] || @@enclosure_classes[in_module] if enclosure.nil? and enclosure = @known_classes[in_module] then - type = /^rb_m/ =~ in_module ? "module" : "class" - handle_class_module in_module, type, enclosure, nil, nil + enc_type = /^rb_m/ =~ in_module ? "module" : "class" + handle_class_module in_module, enc_type, enclosure, nil, nil enclosure = @classes[in_module] end @@ -675,17 +684,21 @@ class RDoc::Parser::C < RDoc::Parser end cm = enclosure.add_class RDoc::NormalClass, class_name, parent_name - - @stats.add_class cm else cm = enclosure.add_module RDoc::NormalModule, class_name - @stats.add_module cm end cm.record_location enclosure.top_level find_class_comment cm.full_name, cm + case cm + when RDoc::NormalClass + @stats.add_class cm + when RDoc::NormalModule + @stats.add_module cm + end + @classes[var_name] = cm @@enclosure_classes[var_name] = cm @known_classes[var_name] = cm.full_name diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index 9649933fd0..45d0b1e341 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -236,27 +236,43 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject); assert_equal "this is the Foo class", klass.comment end - def test_do_classes_singleton + def test_do_classes_class_under content = <<-EOF -VALUE cFoo = rb_define_class("Foo", rb_cObject); -VALUE cFooS = rb_singleton_class(cFoo); +/* Document-class: Kernel::Foo + * this is the Foo class under Kernel + */ +VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject); EOF - util_get_class content, 'cFooS' - - assert_equal 'Foo', @parser.singleton_classes['cFooS'] + klass = util_get_class content, 'cFoo' + assert_equal 'Kernel::Foo', klass.full_name + assert_equal "this is the Foo class under Kernel", klass.comment end - def test_do_classes_class_under + def test_do_classes_class_under_rb_path2class content = <<-EOF /* Document-class: Kernel::Foo - * this is the Foo class under Kernel + * this is Kernel::Foo < A::B */ -VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject); +VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_path2class("A::B")); EOF klass = util_get_class content, 'cFoo' - assert_equal "this is the Foo class under Kernel", klass.comment + + assert_equal 'Kernel::Foo', klass.full_name + assert_equal 'A::B', klass.superclass + assert_equal 'this is Kernel::Foo < A::B', klass.comment + end + + def test_do_classes_singleton + content = <<-EOF +VALUE cFoo = rb_define_class("Foo", rb_cObject); +VALUE cFooS = rb_singleton_class(cFoo); + EOF + + util_get_class content, 'cFooS' + + assert_equal 'Foo', @parser.singleton_classes['cFooS'] end def test_do_classes_module |