aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-01-07 22:41:58 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2021-01-07 22:43:40 -0800
commit98bd7e87a08b86c7aa95502428015c3f7b4aae75 (patch)
tree20466d9062363559cf1fdaaa331bf9655dc639b1 /lib/irb
parentd6b2b5bd47952efb6928db7ff1d393f6973e7ccd (diff)
downloadruby-98bd7e87a08b86c7aa95502428015c3f7b4aae75.tar.gz
[ruby/irb] Make IRB::ColorPrinter.pp compatible with PP.pp
The incompatible interface is not helpful, again if you want to use it as a standalone library, falling it back to PP. Original PP.pp also ends with `out << "\n"`. https://github.com/ruby/irb/commit/4c74c7d84c
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/color_printer.rb2
-rw-r--r--lib/irb/inspector.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb
index 11885f465d..73a150f881 100644
--- a/lib/irb/color_printer.rb
+++ b/lib/irb/color_printer.rb
@@ -8,7 +8,7 @@ module IRB
q = ColorPrinter.new(out, width)
q.guard_inspect_key {q.pp obj}
q.flush
- out
+ out << "\n"
end
def text(str, width = nil)
diff --git a/lib/irb/inspector.rb b/lib/irb/inspector.rb
index 92de2830bc..c2f3b605db 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -116,7 +116,7 @@ module IRB # :nodoc:
}
Inspector.def_inspector([true, :pp, :pretty_inspect], proc{require "irb/color_printer"}){|v|
if IRB.conf[:MAIN_CONTEXT]&.use_colorize?
- IRB::ColorPrinter.pp(v, '')
+ IRB::ColorPrinter.pp(v, '').chomp
else
v.pretty_inspect.chomp
end