[ruby/set] Make Set#pretty_print IRB::ColorPrinter friendly

https://github.com/ruby/set/commit/f467028cdb
This commit is contained in:
Kazuki Tsujimoto 2021-05-23 20:10:21 +09:00 committed by Hiroshi SHIBATA
parent a6459081bc
commit f360ebb306

View File

@ -834,13 +834,14 @@ class Set
alias to_s inspect alias to_s inspect
def pretty_print(pp) # :nodoc: def pretty_print(pp) # :nodoc:
pp.text sprintf('#<%s: {', self.class.name) pp.group(1, sprintf('#<%s:', self.class.name), '>') {
pp.nest(1) { pp.breakable
pp.group(1, '{', '}') {
pp.seplist(self) { |o| pp.seplist(self) { |o|
pp.pp o pp.pp o
} }
} }
pp.text "}>" }
end end
def pretty_print_cycle(pp) # :nodoc: def pretty_print_cycle(pp) # :nodoc: