diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 0910052def..4a55eb0448 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -752,6 +752,9 @@ def parse_class container, single, tk, comment cls.line = line_no + # after end modifiers + read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS + cls end @@ -1311,6 +1314,9 @@ def parse_method(container, single, tk, comment) meth.comment = comment + # after end modifiers + read_documentation_modifiers meth, RDoc::METHOD_MODIFIERS + @stats.add_method meth end @@ -1542,6 +1548,9 @@ def parse_module container, single, tk, comment mod.add_comment comment, @top_level parse_statements mod + # after end modifiers + read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS + @stats.add_module mod end @@ -1715,7 +1724,6 @@ def parse_statements(container, single = NORMAL, current_method = nil, when TkEND then nest -= 1 if nest == 0 then - read_documentation_modifiers container, RDoc::CLASS_MODIFIERS container.ongoing_visibility = save_visibility parse_comment container, tk, comment unless comment.empty? diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 257ec58c63..b62c2a88af 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2513,6 +2513,31 @@ def test_parse_require_dynamic_string assert_equal 1, @top_level.requires.length end + def test_parse_postfix_nodoc + util_parser <<-RUBY +class A +end # :nodoc: + +class B + def a + end # :nodoc: + + def b + end +end +RUBY + + @parser.parse_statements @top_level + + c_a = @top_level.classes.select(&:document_self).first + assert_equal 'B', c_a.full_name + + assert_equal 2, @top_level.classes.length + assert_equal 1, @top_level.classes.count(&:document_self) + assert_equal 1, c_a.method_list.length + assert_equal 'B#b', c_a.method_list.first.full_name + end + def test_parse_statements_identifier_require content = "require 'bar'"