diff options
author | Takashi Kokubun <[email protected]> | 2021-03-19 19:08:39 -0700 |
---|---|---|
committer | git <[email protected]> | 2021-03-20 20:25:32 +0900 |
commit | 278522f0535d081ff6473f210cb45f923ff8810a (patch) | |
tree | 80ac90fdfc35677accc8906665ad66b3f219549c /lib | |
parent | e019dd24df4ed7063ad80d4c2e4070141793f598 (diff) |
[ruby/irb] Don't call Ruby 2.4+'s String#pretty_print
https://github.com/ruby/irb/commit/89bcf107be
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/color_printer.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb index 92afea51cd..30c6825750 100644 --- a/lib/irb/color_printer.rb +++ b/lib/irb/color_printer.rb @@ -21,6 +21,15 @@ module IRB end end + def pp(obj) + if obj.is_a?(String) + # Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n" + text(obj.inspect) + else + super + end + end + def text(str, width = nil) unless str.is_a?(String) str = str.inspect |