Skip to content

Instantly share code, notes, and snippets.

@esmerino
Created March 4, 2015 17:17
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 esmerino/796c1bd497a7c8d4db59 to your computer and use it in GitHub Desktop.
Save esmerino/796c1bd497a7c8d4db59 to your computer and use it in GitHub Desktop.
Pry.config.editor = ENV.fetch("EDITOR", "subl -w")
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 "pry-meta"
Pry.config.print = proc do |output, value|
Pry::Helpers::BaseHelpers
.stagger_output("=> #{value.ai}", output)
end
Pry.commands.alias_command "c", "continue"
Pry.commands.alias_command "s", "step"
Pry.commands.alias_command "n", "next"
rescue LoadError => error
warn "=> Unable to load pry-meta"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment