Your example could be improved by using "products.sort_by(&:cost).last"
I try to not use map because often there are methods that already implement filtering. Gotta love Ruby readability.
Your example could be improved by using "products.sort_by(&:cost).last"
I try to not use map because often there are methods that already implement filtering. Gotta love Ruby readability.