tbrent tbrent - 5 months ago 29
Ruby Question

Convert array of hashes to array

I have a array of hashes that i need the value side of the hashes in an array.
The array of hashes look like this with a couple thousand of them.

{:code=>"404"}, {:code=>"302"}, {:code=>"200"}

I have looked but can only find where it converts from a hash.
How would I go about doing this?

a=[{:code=>"404"}, {:code=>"302"}, {:code=>"200"}] 
puts a.map{|x|x.values}.flatten.inspect


["404", "302", "200"]