ANN: GuessMethod 0.1.0

I’m pleased to announce version 0.1 of my little aggressive spelling
corrector for irb.

sudo gem install guessmethod

And live the life!

– an irb session:
003:0> Strin.tos
attention: replacing non-existant constant Strin with String for
Object
attention: sending to_s instead of tos to String:Class
“String”

This is not for production! And it’s not for Rails either. It kills
Rails. Until I figure out how to make GuessMethod not kill Rails, it
will kill Rails (and anything else that uses method_missing
obscenely).

That being said, I use it all the time. My irb sessions are full of
pretty messages and corrected typos.

Enjoy!

Chris

On 9/24/07, Chris S. [email protected] wrote:

I’m pleased to announce version 0.1 of my little aggressive spelling
corrector for irb.

sudo gem install guessmethod

And live the life!

Interesting idea, some potential improvements.

A simple way to improve guessmethods behavior for libraries that rely
on overriding method_missing would be to start your method_missing
replacement with a check to see if self.respond_to?(method) and then
dispatch the old method_missing.

This will only prevent killing code that was previously working, and
not enable any improvements in method guessing. To correctly handle
method-guessing I would suggest to introduce some api for guessmethod
which one could interact with. So that rails-models could define a
method like guess_similar_methods(method) or something like that.

If you mainly use this for your irb-sessions, another suggestion might
be to have an interactive mode, when you are not able to find a good
method. So that you get a scenario similar to:

001:0> Model.new.tedt = “test”
The instance of Model doesn’t respond to ‘tedt=’.
If you misspelled the name, type the correct name, otherwise leave
blank:
test=
=> “test”
002:0>

It’s not a massive improvement but at least it saves you from some
editing, and would also come in handy when the involved computations
are long-running.

!g

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs