summaryrefslogtreecommitdiff
path: root/lib/pp.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-11-07 11:47:43 +0100
committergit <[email protected]>2024-11-12 02:11:43 +0000
commit107a4da122126e6d0e0ad12898d7511e472709a3 ()
treed30172f09e4a0e81f24075ddf19bc8589377ea2d /lib/pp.rb
parent4c270200dbc2a3a4511e8b793a033078afd6fb31 (diff)
[ruby/pp] Data#pretty_print handle privated or removed members
[Bug #20808] The previous implementation assumed all members are accessible, but it's possible for users to change the visibility of members or to entirely remove the accessor. https://.com/ruby/pp/commit/fb19501434
-rw-r--r--lib/pp.rb16
1 files changed, 14 insertions, 2 deletions
@@ -451,13 +451,25 @@ class Data # :nodoc:
class_name = PP.mcall(self, Kernel, :class).name
class_name = " #{class_name}" if class_name
q.group(1, "#<data#{class_name}", '>') {
- q.seplist(PP.mcall(self, Kernel, :class).members, lambda { q.text "," }) {|member|
q.breakable
q.text member.to_s
q.text '='
q.group(1) {
q.breakable ''
- q.pp public_send(member)
}
}
}