Skip to content

Commit

Permalink
Add comment to document why we set object visibility
Browse files Browse the repository at this point in the history
Co-authored-by: Stan Lo <[email protected]>
  • Loading branch information
flavorjones and st0012 authored Jun 13, 2024
1 parent 9f2a9f2 commit 0d7b5c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rdoc/class_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d7b5c7

Please sign in to comment.