Skip to content

Instantly share code, notes, and snippets.

@carolineartz
Last active January 11, 2016 19:14
Show Gist options
  • Save carolineartz/77af51f7b968dee84391 to your computer and use it in GitHub Desktop.
Save carolineartz/77af51f7b968dee84391 to your computer and use it in GitHub Desktop.
# ENHANCED CONSOLE OUTPUT
#
# Adds directories to load path so that `require` can locate and source
GEM_PATH = '/Users/caroline.artz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/'
$LOAD_PATH.push(GEM_PATH + 'awesome_print-1.6.1/lib/',
GEM_PATH + 'unicode_utils-1.4.0/lib/',
GEM_PATH + 'coolline-0.5.0/lib/',
GEM_PATH + 'pry-coolline-0.2.5/lib/',
GEM_PATH + 'coderay-1.1.0/lib/')
# Gems
# `gem install <gem name>` to avoid needing to add to project Gemfiles
# - coolline and coderay provide syntax highlighting as you type
# - awesome_print pretty prints output
require 'awesome_print'
require 'coolline'
require 'pry-coolline'
require 'coderay'
AwesomePrint.pry!
# CUSTOM HELPERS
#
# adds helper method for exploring methods
# http://rakeroutes.com/blog/customize-your-irb/
class Object
def interesting_methods
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end
end
end
# Adds shortcuts for byebug nav
if defined?(PryByebug)
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
end
Pry::Commands.command /^$/, "repeat last command" do
_pry_.run_command Pry.history.to_a.last
end
Pry.config.editor = "subl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment