Skip to content

Commit

Permalink
Workaround for JRuby 🚑
Browse files Browse the repository at this point in the history
  • Loading branch information
rf- committed Oct 14, 2012
1 parent ced328d commit 98aa9a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/pry/command.rb
Expand Up @@ -337,7 +337,10 @@ def process_line(line)
# Note that if we find the '| do' or '| {' we delete this and the # Note that if we find the '| do' or '| {' we delete this and the
# elements following it from `arg_string`. # elements following it from `arg_string`.
def pass_block(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 return if !block_index


Expand Down

1 comment on commit 98aa9a4

@rf-
Copy link
Member Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.