I have a hash getting in the controller from coffeescript:
h = {"1"=>"[2, 44]", "3"=>"[50]", "4"=>"[43, 42]", "9"=>"[48, 40, 45, 41]"}
Actually, I need the value as integers,but here it returns as a string like the below:
h["9"] , it will return "[48, 40, 45, 41]" .
How can I get it as an integer array.Please help
Thanks
h.transform_values { |s| s.scan(/\d+/).map(&:to_i) } #=> {"1"=>[2, 44], "3"=>[50], "4"=>[43, 42], "9"=>[48, 40, 45, 41]}.