From: Gabe Boyer Date: 2006-07-29T00:32:23+09:00 Subject: Re: Using a '-' in a Key name in a Hash ------=_Part_11440_27986462.1154100738202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/28/06, Andrew Knott wrote: > > Hi, > > This a ruby question but it comes up in the context of Rails, hope that > is OK. > > I am trying to to consume a web service that has a structure element > called 'remote-ip'. (as below) > > result = server.call("IsValid", > {:username=>"me",:password=>"pass",:remote-ip=>request.remote_ip > },@formattednumber) > > > This ofcourse doesn't work right now because I can't have a '-' in a key > name? Is there any way around this or am I screwed? > > thanks so much for any help. > > Andrew > > -- > Posted via http://www.ruby-forum.com/. > > You can have '-' in a key name, you simply can't have '-' in a symbol literal. You can create the proper symbol like so: remote_ip = :"remote-ip" -Gabe ------=_Part_11440_27986462.1154100738202--