summaryrefslogtreecommitdiff
path: root/lib/pp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pp.rb')
-rw-r--r--lib/pp.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index 9678774b8c..5356b7ce25 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -418,6 +418,21 @@ class Range # :nodoc:
end
end
+class String
+ def pretty_print(q)
+ lines = self.lines
+ if lines.size > 1
+ q.group(0, '', '') do
+ q.seplist(lines, lambda { q.text ' +'; q.breakable }) do |v|
+ q.pp v
+ end
+ end
+ else
+ q.text inspect
+ end
+ end
+end
+
class File < IO # :nodoc:
class Stat # :nodoc:
def pretty_print(q) # :nodoc: