aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/enumerable.rb
blob: fededbfcac1a1dabdf3e05905803f27470352a9e (plain)
1
2
3
4
5
6
7
8
9
10
11
module Enumerable
  def flat_map
    return to_enum(:flat_map) unless block_given?
    r = []
    each do |*args|
      result = yield(*args)
      result.respond_to?(:to_ary) ? r.concat(result) : r.push(result)
    end
    r
  end unless method_defined?(:flat_map)
end