dotfiles/languages/ruby/irbrc

16 lines
461 B
Plaintext
Raw Normal View History

2009-07-05 01:26:55 +10:00
begin
require 'rubygems' unless defined? Gem
2010-11-22 14:53:06 +11:00
require 'irbtools'
2009-07-05 01:26:55 +10:00
rescue LoadError
2010-11-22 14:53:06 +11:00
$stderr.puts "Please install 'irbtools' or add it to your Gemfile"
2009-07-05 01:26:55 +10:00
end
class Object
# Return a list of methods defined locally for a particular object. Useful
# for seeing what it does whilst losing all the guff that's implemented
# by its parents (eg Object).
def local_methods(obj = self)
(obj.methods - obj.class.superclass.instance_methods).sort
end
2009-06-10 13:02:44 +10:00
end