saikek
saikek

Reputation: 1109

savon ruby colon inside hash

Is it possible somehow in Ruby to write in hash something like this:

"xmlns:soap"

So it will something like

:xmlns:soap

Upvotes: 0

Views: 144

Answers (2)

Christoph Petschnig
Christoph Petschnig

Reputation: 4157

:"xmlns:soap"

will create a Symbol out of your String, regardless of the containing characters. This is the same as writing:

"xmlns:soap".to_sym

Upvotes: 5

Salil
Salil

Reputation: 47482

No anything between the double quotes " is a string/ So it will not allowed.

However you can do something like following

{value: :abc} # this will produce {:value=>:abc} 

Note:- above code will work only for Ruby 1.9.3 for older versions write simply

{:value=>:abc} 

Upvotes: -1

Related Questions