ANN: GuessMethod 0.1.0

C

Chris Shea

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
 
G

Gustav Munkby

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,008
Latest member
KieraMcGuf

Latest Threads

Top