diff options
author | Benoit Daloze <[email protected]> | 2023-11-30 17:04:39 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-01-11 13:44:00 +0000 |
commit | 62382a434561b6fe56d479b8800cf6ccf017463c (patch) | |
tree | 25cfe5704d2c554671459376c7b34653cceb8c31 /lib/pp.rb | |
parent | 3b9cc22536f2a72ece034881aaf568767e8e1e86 (diff) |
[ruby/pp] Use .class.members for pretty printing Data
* Data#members might not be defined, instead it might be defined
on Data subclasses or a module included there. This is notably the
case on TruffleRuby which defines it there for optimization purposes.
In fact the mere presence of Data#members implies a megamorphic call
inside, so it seems best to avoid relying on its existence.
https://github.com/ruby/pp/commit/6a97d36fbb
Diffstat (limited to 'lib/pp.rb')
-rw-r--r-- | lib/pp.rb | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -423,7 +423,7 @@ end class Data # :nodoc: def pretty_print(q) # :nodoc: q.group(1, sprintf("#<data %s", PP.mcall(self, Kernel, :class).name), '>') { - q.seplist(PP.mcall(self, Data, :members), lambda { q.text "," }) {|member| + q.seplist(PP.mcall(self, Kernel, :class).members, lambda { q.text "," }) {|member| q.breakable q.text member.to_s q.text '=' |