Re: I have some problem with convert to symbol, in Hash obje


#1

John:

I want to convert “name” to :symbol

“name”=>“Ilyas store” —> :name => “Ilyas store”

sample only,

irb(main):039:0* h1={“fax”=>“80233923293”, “name”=>“Ilyas store”}
=> {“name”=>“Ilyas store”, “fax”=>“80233923293”}
irb(main):045:0* h2 = {}
irb(main):046:0> h1.each do |k,v|
irb(main):048:1> h2[k.to_sym] = v
irb(main):049:1> end
irb(main):054:0> h2
=> {:fax=>“80233923293”, :name=>“Ilyas store”}

kind regards -botp