aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/color_printer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/color_printer.rb')
-rw-r--r--lib/irb/color_printer.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb
index 187c337187..3667ef16fe 100644
--- a/lib/irb/color_printer.rb
+++ b/lib/irb/color_printer.rb
@@ -10,7 +10,12 @@ module IRB
out
end
- def text(str, width = str.length)
+ def text(str, width = nil)
+ unless str.is_a?(String)
+ str = str.inspect
+ end
+ width ||= str.length
+
case str
when /\A#</, '=', '>'
super(Color.colorize(str, [:GREEN]), width)