I have recently been refactoring some ruby code and was looking for
pointers or tips on how best to accomplish it. One problem that I have
had is finding all references to methods of a class that I was
refactoring. For example, if I have defined:
and I wish to change it to:
# do something slightly different
How do I find all occurances of in the code where objects of type Foo
are doing foo[index]? Searching for  is no help because that is likely
all over the code. There are no type declarations to find instances of
foo. I can search for Foo.new and follow it through functions, etc but
that is often not simple.
Unit tests are helpful to see if my code still works, but even with them
I don’t feel completely secure that I have caught all instances.
Any ideas would be useful.