Created
September 18, 2013 20:44
-
-
Save vagnerzampieri/6615399 to your computer and use it in GitHub Desktop.
Config to PRY
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
| begin | |
| require "pry" | |
| Pry.start | |
| exit | |
| rescue LoadError => e | |
| warn "=> Unable to load pry" | |
| end |
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
| Pry.config.editor = "vim" | |
| Pry.config.prompt = proc do |obj, level, _| | |
| prompt = "" | |
| prompt << "#{Rails.version}@" if defined?(Rails) | |
| prompt << "#{RUBY_VERSION}" | |
| "#{prompt} (#{obj})> " | |
| end | |
| Pry.config.exception_handler = proc do |output, exception, _| | |
| output.puts "\e[31m#{exception.class}: #{exception.message}" | |
| output.puts "from #{exception.backtrace.first}\e[0m" | |
| end | |
| if defined?(Rails) | |
| require "rails/console/app" | |
| require "rails/console/helpers" | |
| TOPLEVEL_BINDING.eval("self").extend ::Rails::ConsoleMethods | |
| end | |
| begin | |
| require "awesome_print" | |
| Pry.config.print = proc {|output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output)} | |
| rescue LoadError => err | |
| warn "=> Unable to load awesome_print" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment