27

Why am I getting this pry error?

[36] pry(main)> s = "pry"
Error: Cannot find local context. Did you use `binding.pry`?

It works fine in this screencast http://pryrepl.org/

1
  • I admit I got the same error today for the first time in my life. I seem to install latest pry. This error appears when one tries to assign value to s, or use s in any other context (sic!) I believe, this is latest release bug of pry. a = 'pry' will work for you. Commented Mar 27, 2015 at 16:25

1 Answer 1

39

It seems that s, c and n are reserved commands on the pry-nav gem, found here, that help you to step through bindings.

Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'

They are set up by default but can be removed by putting:

Pry::Commands.delete 'c'
Pry::Commands.delete 'n'
Pry::Commands.delete 's'

in a file called .pryrc in your root directory.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, looks like this is relatively new.
And it's stuff like this that makes me prefer plain old debugger.
f seems to be reserved as well
Useful for removing the next command that is a Ruby keyword

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.