Skip to content

Commit

Permalink
Make Set#pretty_print IRB::ColorPrinter friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tsj committed May 23, 2021
1 parent a9a82de commit f467028
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f467028

Please sign in to comment.