dotfiles/languages/ruby/irbrc

16 lines
461 B
Plaintext
Executable File

begin
require 'rubygems' unless defined? Gem
require 'irbtools'
rescue LoadError
$stderr.puts "Please install 'irbtools' or add it to your Gemfile"
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
end