Use flat_map over collect + flatten for speed/readability.

Enumerable#flat_map is in 1.9.3+
http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-flat_map

https://github.com/JuanitoFatas/fast-ruby
http://work.stevegrossi.com/2014/10/25/writing-fast-and-idiomatic-ruby/
Merge pull request #1157 from jrafanie/use_flat_map_over_collect_then_flatten

Use flat_map over collect + flatten for speed/readability.