[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ANN: GuessMethod 0.1.0

Chris Shea

9/24/2007 3:14:00 AM

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

3 Answers

Gustav Munkby

9/24/2007 5:41:00 AM

0

On 9/24/07, Chris Shea <cmshea@gmail.com> 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

The Starmaker

5/8/2013 4:56:00 PM

0

Greg Goss wrote:
>
> John Gogo <jfgogo22@yahoo.com> wrote:
>
> >On May 6, 9:27 pm, John Gogo <jfgog...@yahoo.com> wrote:
> >> If the Earth suddenly disappeared from the moon- the moon would not
> >> have any place in the solar system. Its illogical- its like saying-
> >> can a human have a heart and exist without a liver? Venus and Mars
> >> would squeeze the moon out for hierarchy of the gravity situation.
> >
> >Maybe, the moon would be captured by Venus or Mars and be turned into
> >the next Earth.
>
> It depends on how you remove Earth from play. If you bring in a "When
> Worlds Collide" set of planets, they could perturb the moon off in any
> direction. But gravity is an "elastic" force -- it's just about
> impossible to "capture" an object without multiple bodies interacting.
> Capture of the orphan moon would be incomprehensibly unlikely.
>
> If the earth just went "blip" and disappeared, the moon would still be
> in orbit around the sun, just like it is now.


I never knew the sun had a moon. How many moons does the sun have?

Quadibloc

5/8/2013 5:17:00 PM

0

On May 8, 9:24 am, Greg Goss <go...@gossg.org> wrote:

> If the earth just went "blip" and disappeared, the moon would still be
> in orbit around the sun, just like it is now.  The orbit might be a
> trace more eccentric, but I expect the amount of change to be less
> than the printed line width of the orbit in your space atlas.

I felt the change could be more than that, so I checked:

The orbital velocity of the Moon around the Earth, relative to the
Earth, is about 1,023 metres per second. That of the Earth around the
Sun is about 29,800 metres per second. So it's over one part in 30,
enough to make for a significant amount of eccentricity.

John Savard