IRB: What was that method that greps again?

Giles Bowkett continually improves his .irbc file, and I’ve borrowed a few of those tricks. His latest is grep_methods, a helper to search for the methods available on an object. This is a very useful construct, but, as so often happens, there’s a better way baked in.


"my_arbitrary_string".methods.grep /ch/
=> ["each_byte", "match", "chomp!", "chop", "each_with_index", "chomp", "each_line", "each", "chop!"]

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: