Method: Charty::Util.filter_map
- Defined in:
-
lib/charty/util.rb,
lib/charty/util.rb
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/charty/util.rb', line 4 module_function def filter_map(enum, &block) enum.inject([]) do |acc, x| y = block.call(x) if y acc.push(y) else acc end end end |