Created
June 9, 2015 23:16
-
-
Save tdg5/83814ec4b35cd93f8251 to your computer and use it in GitHub Desktop.
Pry Hooks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w[ | |
after_read | |
before_eval | |
after_eval | |
when_started | |
before_session | |
after_session | |
].each do |hook| | |
Pry.config.hooks.add_hook(hook.to_sym, "my_#{hook}_hook") do |_, _, _| | |
puts "hello from #{hook}" | |
end | |
end | |
Pry.commands.before_command("whereami") { |*args| puts "before whereami: #{args.inspect}" } | |
Pry.commands.after_command("whereami") { |*args| puts "after whereami: #{args.inspect}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment