Created
October 20, 2011 05:55
-
-
Save jpablobr/1300522 to your computer and use it in GitHub Desktop.
dot_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
begin | |
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 | |
# Log to STDOUT if in Rails | |
if Object.const_defined?('ActiveRecord') | |
require 'logger' | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment