diff options
author | Kazuki Tsujimoto <[email protected]> | 2021-05-23 20:10:21 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2021-09-28 17:37:41 +0900 |
commit | f360ebb30606a4143029996073d29d007069428d (patch) | |
tree | 7f1c5a031736a811f6f12c98e4b3a57a0348f38d /lib/set.rb | |
parent | a6459081bca72ddb98e0fa971c7b0e225c9343e9 (diff) |
[ruby/set] Make Set#pretty_print IRB::ColorPrinter friendly
https://github.com/ruby/set/commit/f467028cdb
Diffstat (limited to 'lib/set.rb')
-rw-r--r-- | lib/set.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/set.rb b/lib/set.rb index 50399309e3..7832c848cf 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -834,13 +834,14 @@ class Set alias to_s inspect def pretty_print(pp) # :nodoc: - pp.text sprintf('#<%s: {', self.class.name) - pp.nest(1) { - pp.seplist(self) { |o| - pp.pp o + pp.group(1, sprintf('#<%s:', self.class.name), '>') { + pp.breakable + pp.group(1, '{', '}') { + pp.seplist(self) { |o| + pp.pp o + } } } - pp.text "}>" end def pretty_print_cycle(pp) # :nodoc: |