4 ms·
Also, chaining is extremely concise. e.g. "products.map(&:cost).sort.last"
by mmahemoff 8y ago
Also, chaining is extremely concise. e.g. "products.map(&:cost).sort.last"
- klohto 8y agoI couldn't resist... 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.