Ruby Methodfinder Is Still Alive
One thing I always liked about Smalltalk was the “Method Finder” available in several of its dialects. The following screenshot shows the version included in Pharo as an example:
Essentially, this offers two different featues:
- Search for a method by (partial) name.
- Search for a method by example. By inputting a receiver, arguments (optional) and the expected result, one could find all methods that provide this functionality.
In early 2009 I had started teaching courses at [RubyLearning](http://way back in early 2011 i wrote a little hack which i thought might help the students of rubylearning when exploring the language./), and in 2011 it dawned on me that a Ruby version of Method Finder would not only be useful to our students, but also rather easy to implement. So I got hacking, and about an hour later I had a first working prototype which I eventually released as a gem (source). Feedback was enthusiastic, here are some of my favorite tweets from back then:
MethodFinder, where have you been all my life? Example: passing "[1, 2], , [2, 3]" returns "&". Awesome! http://bit.ly/gKu2K0— Ryan Bates (@rbates) March 29, 2011
MethodFinder is one of the coolest things about Squeak. Neat to see it's been ported to Ruby: http://t.co/ScG6ZkO— Avi Bryant (@avibryant) March 29, 2011
MethodFinder in ruby has to be the coolest Gem I've ever seen http://t.co/58MB3q8— Rob Greenwood (@bilco105) March 30, 2011
Over the years I and various contributors added some more features (like method blacklists, playing nicely with Pry, debugging etc.), but there was very little active development.
However, this past weekend I had the opportunity to speak at Ruby X Elixir Conf
Taiwan, where I had a very engaging discussion about
using Ruby in teaching after my talk. This rekindled my interest in
MethodFinder and in the past 3 days the following happened:
- A major code cleanup which was long overdue (not quite done, but it was a good start).
- A new debugging implementation, which is not only more intuitive to use (IMHO of course), but also fixes a bug with hash arguments.
Gem version 2.2.1 was released today (I had to yank 2.2.0, don’t ask), and I have several more ideas for future improvements. I’d eventually also like to add some sort of UI, contact me if you are interested in helping out with that!
tl;dr: Conferences and FOSS are great, do more of both of them if you can :)