From: Just Another Victim of the Ambient Morality Date: 2006-11-25T04:48:53+09:00 Subject: Re: Bug in ruby? "AliasX Neo" wrote in message news:86904d117a12656ca6e35c32fd8bcbe0@ruby-forum.com... > Well, I've spent the last hour or so debugging one of the stupidest > errors I have encountered with Ruby. > > Let's see my code first: > > [code]def parse(string, starting, ending) > istart = string.index(starting) + starting.length > iend = string.index(ending, istart) > return string.slice(istart, iend - istart) > end[/code] > > This function is called about 13 times in my entire script. It breaks on > the last one with this error: > > undefined method `+' for nil:NilClass Just out of wild curiosity, did you ever figure this thing out? We're very eager to learn of bugs in Ruby so they may be fixed although it really looks like this was your error. Surely, it's not outrageous to think that string.index(starting) can return nil. Was this the case for you? Thank you...