-> % gem install pry -N
Fetching pry-0.12.2.gem
Successfully installed pry-0.12.2
1 gem installed
-> % gem list | grep pry
pry (0.12.2)
-> % ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
-> % pry
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/Users/jin/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:40: warning: in `eval'
<main>:1: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/Users/jin/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:41: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/Users/jin/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:88: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/Users/jin/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:80: warning: in `eval'
[1] pry(main)>
I get same warn too.
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/zw963/Dropbox/common/ruby/pry/pry/commands/whereami.rb:40: warning: in `eval'
<main>:1: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/home/zw963/Dropbox/common/ruby/pry/pry/commands/whereami.rb:41: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/zw963/Dropbox/common/ruby/pry/pry/method/weird_method_locator.rb:88: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/zw963/Dropbox/common/ruby/pry/pry/method/weird_method_locator.rb:80: warning: in `eval'
Change as following will fix those warn.
@@ -37,8 +37,8 @@ class Pry
BANNER
def setup
- @file = expand_path(target.eval('__FILE__'))
- @line = target.eval('__LINE__')
+ @file = expand_path(target.source_location[0])
+ @line = target.source_location[1]
@method = Pry::Method.from_binding(target)
end
But, Binding#source_location seem like only available on ruby 2.6+
This is already fixed in master 272b3290b
It's been fixed but there hasn't been a new release in over a year.
Now, the easiest way is to install the master branch. Aside from being correct or not.
gem specific_install [email protected]:pry/pry.git master
I guess a much nicer version of that, which still includes the new fixes but doesn't run the risk of pulling in anything extra would be
# Gemfile
source 'https://rubygems.org'
gem 'pry', git: 'https://github.com/pry/pry.git', ref: '272b3290b5250d28ee82a5ff65aa3b29b825e37b'
This has the advantages of:
1) Being the native Bundler way to install from a github repo
2) Installing a specific git SHA so that you can guarantee consistent gem code between workspaces
@tonobo Is it possible to get a new release for this please?
Looking forward to the next release!
Is a next release scheduled?
I just released v0.13.0, thanks everybody for the pings!
https://rubygems.org/gems/pry/versions/0.13.0
Most helpful comment
@tonobo Is it possible to get a new release for this please?