On Sun, 10 Mar 2002 10:00:34 GMT, Chris "boris" Ross <chris / darkrock.co.uk>
wrote:

>On Sun, Mar 10, 2002 at 11:59:07AM +0900, David Corbin muttered...
>: The following is from my debugging through xmlc.rb
>: 
>: Breakpoint 1, dump_element at xmlc.rb:94
>: xmlc.rb:94:                                     children.push ch unless 
>: (ch == "" || ch == nil)
>: (rdb:1) p ch
>: "\"\n\""
>: (rdb:1) p children
>: []
>: (rdb:1) s
>: xmlc.rb:94: `undefined method `to_str' for nil' (NameError)
>: 
>: How is 'nil' trying to do a to_str?
>: 
>: Thanks
>: David
>: 
>: 
>
>I believe it's a case of ch is a string and therefore to do an equlity check
>ruby is doing:
>
>  ( ch.to_str == "" || ch.to_str == nil.to_str )
>  
>*but* I could be being stupid and wrong,

I'm not saying that, but the code as written runs fine on its own in 1.6.6. I
haven't tried running it in the debugger, since I have this religious thing
about not knowing how to use it. I'm definitely as confused as David by the
happening.

Does the same thing happen when you run the program outside the debugger? 

Ronald E Jeffries
http://www.XProgramming.com
http://www.objectmentor.com
I'm giving the best advice I have. You get to decide whether it's true for you.