From: Robert Klemme Date: 2006-07-08T01:12:07+09:00 Subject: Re: hyphens in variable names 2006/7/7, Paul Hepworth : > Hello, > > I am new to Ruby and have an issue with a xmlsimple object resulting > from a 3rd party webservice. > > The xml has nodes that have hyphens (-) in the names. When I try to > access various hashes using the object variables I get errors telling > that the variable doesn't exists. I realize that the ruby syntax doesnot > like hyphens in variable names, how do I get around this? > > Example XML: > > > > > ... > > ... > > > > Example Ruby : > > for tlist in object.tree-lists > ... > end > > Error would be: > > NoMethodError in TreeController#importproject > undefined method `tree' for # 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]). Kind regards robert > > Thanks in advance. > Paul > > -- > Posted via http://www.ruby-forum.com/. > > -- Have a look: http://www.flickr.com/photos/fussel-foto/