pry/pry — Issue #409: binding.pry has incorrect (self) context 
Author: dnagir
Created: 2012-01-06 04:52:37+00:00
State: open

Using Pry on JRuby and Cucumber/RSpec.

This is the issue:

```ruby
When /a cucumber step/ do
binding.pry
end

# Then when it's hit:
self # main
```

The workaroudn is to always wrap it in a lamda:

```ruby
->{ binding.pry }.call
```

In this case it behaves more like MRI.

```shell
> ruby -v
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) Client VM 1.6.0_29) [darwin-i386-java]
```

I suspect that there may be an issue with JRuby (maybe 1.9 mode). But not sure.