From 6967224ccba4d5c1e5320e3e84ea6259664d3b01 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sat, 26 May 2012 00:30:38 -0700 Subject: [PATCH] MonkeyPatch jruby's Array#pretty_inspect [Fixes #568] --- lib/pry/core_extensions.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/pry/core_extensions.rb b/lib/pry/core_extensions.rb index e8250e60..c51e848f 100644 --- a/lib/pry/core_extensions.rb +++ b/lib/pry/core_extensions.rb @@ -51,3 +51,24 @@ class Object __binding_impl__ end end + +# There's a splat bug on jruby in 1.9 emulation mode, which breaks the +# pp library. +# +# * http://jira.codehaus.org/browse/JRUBY-6687 +# * https://github.com/pry/pry/issues/568 +# +# Until that gets fixed upstream, let's monkey-patch here: +if [[1, 2]].pretty_inspect == "[1]\n" + class Array + def pretty_print(q) + q.group(1, '[', ']') { + i = 0 + q.seplist(self) { |*| + q.pp self[i] + i += 1 + } + } + end + end +end