Skip to content

Instantly share code, notes, and snippets.

@phstc
Created September 22, 2012 03:25
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 phstc/3765013 to your computer and use it in GitHub Desktop.
Save phstc/3765013 to your computer and use it in GitHub Desktop.
.irbrc
# 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