Here’s my (current) .irbrc, with comments
# I am including gems in my irb session. Therefore, the next require
require 'rubygems'
# wirble is a wonderful gem which add nice features to irb
require 'wirble'
# Dr. Nic's useful helper gem. It makes it so you can say:
# foo.map_by_bar
# instead of having to say:
# foo.map{|f| f.bar}
# more to the point you can do
# people.map_by_first_and_last
# instead of
# people.map{|p| [p.first, p.last]}
require 'map_by_method'
# what_methods is a way to see which methods, when performed on an object, return a particular value:
# >> "hi".what? 'h'
# "hi".chop! == "h"
# "hi".chop == "h"
# => ["chop!", "chop"]
require 'what_methods'
# pretty print --> provides a "pretty" view of an object
require 'pp'
# auto indent irb; it's useful for when you're just experimenting
IRB.conf[:AUTO_INDENT]=true
# start wirble (with color)
Wirble.init
#Wirble.colorize
# What are the methods which belong only to an object, and not those inherited from Object
class Object
def my_methods
(self.methods - Object.methods).sort
end
end
# strip html tags from a string
class String
def strip_tags
self.gsub(/<\S[^><]*>/,"")
end
end
I’ve shown mine. Show me yours?
Here are links to the referenced rubygems:
Here’s my github project devoted just to irb goodness: http://github.com/cldwalker/irbfiles/tree/master
Some original but most from others.
If you’re looking for a sweet method inspection tool for irb, check out http://github.com/matthew/method_lister/tree/master