From: jeremy@... (Jeremy Henty) Date: 2001-09-11T21:26:35+09:00 Subject: [ruby-talk:21113] Re: nested method definition!!! In article <3B9B133D.E796CE77@sympatico.ca>, Mark writes: >I keep getting a "nested method definition" error. Although I have >failed to find the documentation for this specific error, I presume it's >when you do the following: >def foo(val1) > def bar(val2) > end >end > >The strange this is, I'm not doing anything like this. Maybe something >in Ruby is broken. I have looked over my code so many times (and it's >only 190 lines), and I can't see a problem. Every time I have seen this it's because I have messed up the grouping in some non-obvious way so that definitions are indeed nested even though I intended nothing of the kind. This can be really hard to spot just by looking at the code (in my experience anyway). I'd recommend the old divide and conquer approach: strip the code down to a minimal fragment that generates the error. At some point the typo just leaps out at you (again in my experience). Can't say anything more useful without a code fragment to examine, I'm afraid. Regards, Jeremy Henty