I have this hash:
my_hash = [
{
:name=> 'fiat 500',
:things=> %w[gps bluetooth automatico],
:year=> '2021'
},
{
:name=> 'fusca',
:things=> %w[som dvd automatico],
:year=> '2022'
}
]
I want to create a new array but only with the key :year, where would be like this:
new_array = [
{
:year=> '2021'
},
{
:year=> '2022'
}
]
I'm a beginner in ruby and I can't do it.
my_hash = [...]" – that's actually an array.