Skip to content

Instantly share code, notes, and snippets.

@banister
Created June 23, 2012 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/0d56bcbf8f7eedd57634 to your computer and use it in GitHub Desktop.
Save banister/0d56bcbf8f7eedd57634 to your computer and use it in GitHub Desktop.
_pry_.hooks.add_hook(:before_eval, :kill_ruby) do |code, pry|
if !code.empty?
pry.suppress_output = true
pry.output.puts "Command #{code.strip} not found, type 'help'"
code.replace("")
end
end
# => #<Pry::Hooks:0x00000101af9388
# @errors=[],
# @hooks=
# {:before_session=>
# [[:default,
# #<Proc:0x00000101af9310@/Users/john/ruby/projects/pry/lib/pry.rb:11>]],
# :after_session=>
# [[:delete_frame_manager,
# #<Proc:0x00000102846a40@/Users/john/.rvm/gems/ruby-1.9.2-p180/gems/pry-stack_explorer-0.4.2/lib/pry-stack_explorer.rb:118>]],
# :when_started=>
# [[:save_caller_bindings,
# #<PryStackExplorer::WhenStartedHook:0x000001028469a0>],
# [:try_enable_exception_explorer,
# #<Proc:0x00000101c7f950@/Users/john/.rvm/gems/ruby-1.9.2-p180/gems/pry-exception_explorer-0.1.9/lib/pry-exception_explorer.rb:219>]],
# :after_read=>[],
# :before_eval=>[[:kill_ruby, #<Proc:0x00000101ec30b8@(pry):1>]],
# :after_eval=>[]}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment