Created
August 2, 2010 02:57
-
-
Save fridim/504050 to your computer and use it in GitHub Desktop.
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
%w|rubygems wirble hirb utility_belt|.each do|lib| | |
begin | |
require lib | |
rescue LoadError => err | |
warn "Couldn't load an irb gem: #{err}" | |
end | |
end | |
# wirble (colors) | |
Wirble.init | |
Wirble.colorize | |
# hirb (active record) | |
Hirb::View.enable | |
# IRB Options | |
IRB.conf[:AUTO_INDENT] = true | |
require 'yaml' | |
module Kernel | |
def method_list(levels = 1) | |
if self.is_a? Module | |
klass, method_function = self, :public_methods | |
else | |
klass, method_function = self.class, :public_instance_methods | |
eigen = self.singleton_methods | |
if !eigen.empty? | |
puts :Eigenclass # sorry for not being up to date, I just love the word | |
puts self.singleton_methods.sort.to_yaml | |
end | |
end | |
levels.times{ |level| | |
if cur = klass.ancestors[level] | |
puts cur # put class name | |
puts cur.send(method_function, false).to_yaml # put methods of the class | |
else | |
break | |
end | |
} | |
self # or whatever | |
end | |
alias mm method_list | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment