Skip to content

Instantly share code, notes, and snippets.

@so77id
Created March 28, 2016 20:34
Show Gist options
  • Save so77id/9a0a7a4aa8d6a76b8a83 to your computer and use it in GitHub Desktop.
Save so77id/9a0a7a4aa8d6a76b8a83 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
#~/.irbrc
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:AUTO_INDENT] = true
begin
require "awesome_print"
AwesomePrint.irb!
rescue Exception => e
puts e
end
begin
require "irbtools" unless defined? Rails
rescue Exception => e
puts e
end
unless defined?(reload!)
$files = []
def load!(file)
$files << file
load file
end
def reload!
$files.each { |f| load f }
end
end
class Object
# list methods which aren't in superclass
def local_methods(obj = self)
m = (obj.methods - obj.class.superclass.instance_methods).sort
(defined? AwesomePrint) ? ap(m) : m
end
end
def r
reload!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment