Ruby array transform question from reddit

https://www.reddit.com/r/rubyonrails/comments/oc96dt/hello_i_need_help_to_change_this_array_of_objects/

The question:
https://gist.github.com/cjavdev/7bafa99f8eb0517fd1711f1e870130db

A solution: https://replit.com/@CJAvilla/array-fun#main.rb