Created
September 22, 2012 03:25
-
-
Save phstc/3765013 to your computer and use it in GitHub Desktop.
.irbrc
This file contains 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
# Autocomplete | |
require "irb/completion" | |
require "rubygems" | |
require "pp" | |
# Add all gems installed in the system to the $LOAD_PATH | |
# so they can be used in Rails console with Bundler | |
if defined?(::Bundler) | |
gem_paths = Dir.glob("/usr/local/lib/ruby/gems/1.9.1/gems/**/lib") | |
gem_paths.each do |path| | |
$LOAD_PATH << path | |
end | |
end | |
begin | |
require "ap" | |
rescue LoadError | |
puts "=> Unable to load awesome_print" | |
end | |
IRB.conf[:AUTO_INDENT] = true | |
# Get all the methods for an object that aren't basic methods from Object | |
class Object | |
def local_methods | |
(methods - Object.instance_methods).sort | |
end | |
end | |
# Show Rails log on console | |
if ENV.include?("RAILS_ENV") && !Object.const_defined?("RAILS_DEFAULT_LOGGER") | |
require "logger" | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
end | |
# Aliases | |
alias q exit | |
begin | |
require "pry" | |
Pry.start | |
exit | |
rescue LoadError => e | |
warn "=> Unable to load pry" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment