@@ -1558,32 +1558,45 @@ def parse_visibility(container, single, tk)
15581558 when TkNL , TkUNLESS_MOD , TkIF_MOD , TkSEMICOLON then
15591559 container . ongoing_visibility = vis
15601560 else
1561- if vis_type == 'module_function' then
1561+ new_methods = [ ]
1562+
1563+ case vis_type
1564+ when 'module_function' then
15621565 args = parse_symbol_arg
15631566 container . set_visibility_for args , :private , false
15641567
1565- module_functions = [ ]
1566-
15671568 container . methods_matching args do |m |
15681569 s_m = m . dup
15691570 s_m . record_location @top_level
15701571 s_m . singleton = true
1571- s_m . visibility = :public
1572- module_functions << s_m
1572+ new_methods << s_m
15731573 end
1574+ when 'public_class_method' , 'private_class_method' then
1575+ args = parse_symbol_arg
15741576
1575- module_functions . each do |s_m |
1576- case s_m
1577- when RDoc ::AnyMethod then
1578- container . add_method s_m
1579- when RDoc ::Attr then
1580- container . add_attribute s_m
1577+ container . methods_matching args , true do |m |
1578+ if m . parent != container then
1579+ m = m . dup
1580+ m . record_location @top_level
1581+ new_methods << m
15811582 end
1583+
1584+ m . visibility = vis
15821585 end
15831586 else
15841587 args = parse_symbol_arg
15851588 container . set_visibility_for args , vis , singleton
15861589 end
1590+
1591+ new_methods . each do |method |
1592+ case method
1593+ when RDoc ::AnyMethod then
1594+ container . add_method method
1595+ when RDoc ::Attr then
1596+ container . add_attribute method
1597+ end
1598+ method . visibility = vis
1599+ end
15871600 end
15881601 end
15891602
0 commit comments