Optimize flat_map to iterate once instead of twice

```ruby
require 'benchmark/ips'

ARRAY = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]
PROC  = proc { |x| x }

def slow(enum, &block)
  enum.map(&block).flatten(1)
end

def fast(enum, &block)
  enum.inject([]) do |a, e|
    result = block.call(e)
    result.respond_to?(:to_ary) ? a.concat(result) : a.push(result)
  end
end

Benchmark.ips do |x|
  x.report("slow") { slow(ARRAY, &PROC) }
  x.report("fast") { fast(ARRAY, &PROC) }
end
```

```
slow   284275.5 (±8.1%) i/s -    1433280 in   5.076192s
fast   393309.5 (±9.3%) i/s -    1960256 in   5.031239s
```