Permalink
Browse files

Workaround for JRuby 🚑

  • Loading branch information...
1 parent ced328d commit 98aa9a40aaebf709c36e1dc8d411114b089801c4 @rf- rf- committed Oct 14, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/pry/command.rb
View
@@ -337,7 +337,10 @@ def process_line(line)
# Note that if we find the '| do' or '| {' we delete this and the
# elements following it from `arg_string`.
def pass_block(arg_string)
- block_index = arg_string.rindex(/\| *(?:do|\{)/)
+ # Workaround for weird JRuby bug where rindex in this case can return nil
+ # even when there's a match.
+ arg_string.scan(/\| *(?:do|\{)/)
+ block_index = $~ && $~.offset(0)[0]
return if !block_index

1 comment on commit 98aa9a4

@rf-
Member
rf- commented on 98aa9a4 Oct 14, 2012

This bug is fixed in JRuby 1.7.0RC2, so I guess we should just leave the workaround in for the foreseeable future.

Please sign in to comment.