File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,8 @@ def report_methods cm
352352 next if method . documented? and not param_report
353353 report << " # in file #{ method . file . full_name } "
354354 report << param_report if param_report
355- report << " def #{ method . name } #{ method . params } ; end"
355+ scope = method . singleton ? 'self.' : nil
356+ report << " def #{ scope } #{ method . name } #{ method . params } ; end"
356357 report << nil
357358 end
358359
Original file line number Diff line number Diff line change @@ -331,6 +331,40 @@ class C # is documented
331331 # in file file.rb
332332 def m1; end
333333
334+ end
335+ EXPECTED
336+
337+ assert_equal expected , report
338+ end
339+
340+ def test_report_method_class
341+ c = @tl . add_class RDoc ::NormalClass , 'C'
342+ c . record_location @tl
343+ c . add_comment 'C' , @tl
344+
345+ m1 = RDoc ::AnyMethod . new nil , 'm1'
346+ m1 . record_location @tl
347+ m1 . singleton = true
348+ c . add_method m1
349+
350+ m2 = RDoc ::AnyMethod . new nil , 'm2'
351+ m2 . record_location @tl
352+ m2 . singleton = true
353+ c . add_method m2
354+ m2 . comment = 'm2'
355+
356+ RDoc ::TopLevel . complete :public
357+
358+ report = @s . report
359+
360+ expected = <<-EXPECTED
361+ The following items are not documented:
362+
363+ class C # is documented
364+
365+ # in file file.rb
366+ def self.m1; end
367+
334368end
335369 EXPECTED
336370
You can’t perform that action at this time.
0 commit comments