1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Workaround for JRuby 🚑

This commit is contained in:
Ryan Fitzgerald 2012-10-13 19:46:37 -07:00
parent ced328d38a
commit 98aa9a40aa

View file

@ -337,7 +337,10 @@ class Pry
# 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