# ANN: GuessMethod 0.1.0

**URL:** <https://www.ruby-forum.com/t/ann-guessmethod-0-1-0/115336>\
**Category:** Ruby\
**Created:** [September 24, 2007, 5:16am UTC](https://www.ruby-forum.com/t/ann-guessmethod-0-1-0/115336 "2007-09-24T05:16:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [September 24, 2007, 5:16am UTC](https://www.ruby-forum.com/t/ann-guessmethod-0-1-0/115336/1 "2007-09-24T05:16:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [September 24, 2007, 7:42am UTC](https://www.ruby-forum.com/t/ann-guessmethod-0-1-0/115336/2 "2007-09-24T07:42:47Z")

</div>

On 9/24/07, Chris S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
