Skip to content

Instantly share code, notes, and snippets.

@fridim
Created August 2, 2010 02:57
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 fridim/504050 to your computer and use it in GitHub Desktop.
Save fridim/504050 to your computer and use it in GitHub Desktop.
%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