I felt like having a look at the code and found something that might be useful, you either have to add it to the gemfile or you might be able to add it to your .pryrc
(I don't know if this gets called from binding.pry
or not). From github there appears to be:
# @example Adding a hook for the `:before_session` event.
Pry.config.hooks.add_hook(:before_session, :say_hi) do
puts "hello"
end
From the pry github hooks file.
EDIT: Here's an example to register the hook and execute it (i.e. init your app) from another part of the pry github hooks file:**
my_hook = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
my_hook.exec_hook(:before_session) #=> OUTPUT: "hi!"