diff options
| author | Benoit Daloze <eregontp@gmail.com> | 2023-11-30 17:10:40 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-01-11 13:44:01 +0000 |
| commit | 1ed3b6037566cef3d56e882eb0fcf1b14553f540 (patch) | |
| tree | 0aff22917c79cb6dd5e475dcb59050fd4a257953 /lib | |
| parent | 62382a434561b6fe56d479b8800cf6ccf017463c (diff) | |
[ruby/pp] Fix pretty printing a Data subclass instance when the subclass is anonymous
* It would be "#<data a=42>" (double space) instead of "#<data a=42>" (like #inspect).
https://github.com/ruby/pp/commit/bed72bfcb8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pp.rb | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -422,7 +422,9 @@ end class Data # :nodoc: def pretty_print(q) # :nodoc: - q.group(1, sprintf("#<data %s", PP.mcall(self, Kernel, :class).name), '>') { + 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 |
