From 0d7b5c7abf0cda05f68c3f31589848765b0bc494 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 13 Jun 2024 11:28:31 -0400 Subject: [PATCH] Add comment to document why we set object visibility Co-authored-by: Stan Lo --- lib/rdoc/class_module.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb index 3d94d78698..a99acb8956 100644 --- a/lib/rdoc/class_module.rb +++ b/lib/rdoc/class_module.rb @@ -833,6 +833,8 @@ def prepare_to_embed(code_object, singleton=false) code_object.mixin_from = code_object.parent code_object.singleton = true if singleton set_current_section(code_object.section.title, code_object.section.comment) + # add_method and add_attribute will reassign self's visibility back to the method/attribute + # so we need to sync self's visibility with the object's to properly retain that information self.visibility = code_object.visibility code_object end