Hacker News new | ask | show | jobs
by Rafert 2374 days ago
2.7 introduces `Enumerable#filter_map` for that. Example from the NEWS file:

[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]