Created
November 22, 2011 21:10
-
-
Save pgroudas/1386976 to your computer and use it in GitHub Desktop.
Simple .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
#!/usr/bin/ruby | |
require 'irb/completion' | |
require 'irb/ext/save-history' | |
require 'rubygems' | |
IRB.conf[:USE_READLINE] = true | |
IRB.conf[:SAVE_HISTORY] = 1000 | |
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history" | |
IRB.conf[:PROMPT_MODE] = :SIMPLE | |
IRB.conf[:AUTO_INDENT] = true | |
class Object | |
# list methods which aren't in superclass | |
def local_methods(obj = self) | |
(obj.methods - obj.class.superclass.instance_methods).sort | |
end | |
def ri(method = nil) | |
unless method && method =~ /^[A-Z]/ # if class isn't specified | |
klass = self.kind_of?(Class) ? name : self.class.name | |
method = [klass, method].compact.join('#') | |
end | |
puts `ri '#{method}'` | |
end | |
end | |
def r | |
reload! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment