ruby - Is there a way to autoexecute code when Pry is triggered? -
When the code faces automatically code Is there a way to execute?
For example, if I want to execute I find that to look at the code and find something that could be useful, It must be added to gemfile or you might be able to add it to your Edit: Here's an example to register hooks and execute it (i.e. your app init): ** , then puts "Hey, I'm debugging!" Every time the
bindings What is called ?
.pryrc (I do not know if it is called from
binding.pry or No). From Jithub it appears:
# @example `: before_session` Adding a hook for the event. Pry.config.hooks.add_hook (: before_session, say_hi) puts "hello" end
my_hook = Pry :: hook. NY AD_HOOK (: before_session, say_hi) {puts "hi!" } My_hook.exec_hook (: before_session) # = & gt; Output: "Hello!"
Comments
Post a Comment