On 8/21/07, CharlesWinstead / gmail.com <CharlesWinstead / gmail.com> wrote: > Hi All, > > I'm definitely a newbie. I've tried to read the faq first but the > links weren't working. I did read through some old posts. > > I understand that the dynamic nature of Ruby is pretty powerful, but I > have an application where our Ruby code is managing the execution of > design tools that take a long time to run. We're getting bit by having > typos in our methods or variables that we don't find until execution > time, which can take hours. Is there any utility or settings in Ruby > that can flag these at compile time? I used unit tests and rcov for that - write simple tests that run at least once through the code to catch these typos. Then run them with rcov (gem install rcov) to see the coverage - what code has been tested and what not. Finally either write more tests for the uncovered parts or look at them more carefully ;-) The thoroughness of this depends on the tests you write - it's possible that in one scenario you get object that has one particular method, and another time you get different object that hasn't. Your goal is to cover as much of these cases as possible. You don't have to call your long-running stuff (=design tools?) in the tests - you should avoid them as much as possible, using so called mock objects to simulate the behavior of the expensive methods/objects. The goal is to have tests, that will quickly check your code for errors. For more info see test/unit, zentest or general test-driven development (TDD) docs. Other than that, there's no compile time, there's "parse time" interleaved with "execution time". Try turning -w on (i.e. ruby -w <your script>) to see more warnings. Maybe something from ParseTree gem and friends might be useful as well, but I don't think there's a tool to do this particular thing (check for undefined methods).