Skip to content

Commit d9ae8b8

Browse files
flavorjonesst0012
andcommitted
Add comment to document why we set object visibility
Co-authored-by: Stan Lo <[email protected]>
1 parent 79629dc commit d9ae8b8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/rdoc/code_object/class_module.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,8 @@ def prepare_to_embed(code_object, singleton=false)
833833
code_object.mixin_from = code_object.parent
834834
code_object.singleton = true if singleton
835835
set_current_section(code_object.section.title, code_object.section.comment)
836+
# add_method and add_attribute will reassign self's visibility back to the method/attribute
837+
# so we need to sync self's visibility with the object's to properly retain that information
836838
self.visibility = code_object.visibility
837839
code_object
838840
end

0 commit comments

Comments
 (0)