ruby-changes:68161
From: Kazuki <ko1@a...>
Date: Tue, 28 Sep 2021 19:16:00 +0900 (JST)
Subject: [ruby-changes:68161] f360ebb306 (master): [ruby/set] Make Set#pretty_print IRB::ColorPrinter friendly
https://git.ruby-lang.org/ruby.git/commit/?id=f360ebb306 From f360ebb30606a4143029996073d29d007069428d Mon Sep 17 00:00:00 2001 From: Kazuki Tsujimoto <kazuki@c...> Date: Sun, 23 May 2021 20:10:21 +0900 Subject: [ruby/set] Make Set#pretty_print IRB::ColorPrinter friendly https://github.com/ruby/set/commit/f467028cdb --- lib/set.rb | 11 ++++++----- 1 file 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 https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L834 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: -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/