I want the .pryrc for a particular project to cd to a class context that will be the context for 99% of all pry sessions in that project.
just doing:
cd MyModule
doesn’t work:
Error loading ./.pryrc: undefined method `cd' for main:Object
which is confusing because methods defined in the .pryrc are in the pry session context.
Pry.cd MyModule
also doesn’t work.
I think we will add better support for this in the future, but in the meantime put this in your
.pryrc:Pry.config.hooks.add_hook(:before_session, :set_context) { |_, _, pry| pry.input = StringIO.new("cd MyModule") }
If you would like to see better support for this feature in the future, please file an issue