From: Paul Hepworth Date: 2006-07-08T01:26:36+09:00 Subject: Re: hyphens in variable names Jacob Fugal wrote: > On 7/7/06, Robert Klemme wrote: >> Either use method send or use another tool to work with XML or use >> another way to access objects (if this lib provides one, maybe >> object["tee-list"] or object[:tree-list]). > > I agree with Robert that if the lib provides hash-style access, that's > probably a cleaner way to go. Note, though, that if the hash needs a > symbol rather than a string, it will need to use quotes also, as I did > in my other post: > > object[:'tree-list'] Now that makes sense. I never tried it like this. Wow, what an insight. :) > > Omitting the quotes would give a syntax error: > > $ irb > >> hash = {} > => {} > >> hash[:tree-list] > NameError: undefined local variable or method `list' for main:Object That is the error that I saw all too often. > > Jacob Fugal -- Posted via http://www.ruby-forum.com/.