From f467028cdb0d57c57262ef3650eddf1b94776c33 Mon Sep 17 00:00:00 2001 From: Kazuki Tsujimoto Date: Sun, 23 May 2021 20:10:21 +0900 Subject: [PATCH] Make Set#pretty_print IRB::ColorPrinter friendly --- lib/set.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/set.rb b/lib/set.rb index 682cb74..761c535 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -822,13 +822,14 @@ def inspect 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: