Move to flat_map now that we don't use 1.8

This commit is contained in:
Ben Hollis 2013-11-18 22:22:18 -08:00
parent ac64b17ef0
commit 7f1285a773
2 changed files with 3 additions and 4 deletions

View file

@ -139,15 +139,14 @@ module Middleman
# @param paths Some paths string or Pathname
# @return [Array] An array of filenames
def self.all_files_under(*paths)
# when we drop 1.8, replace this with flat_map
paths.map do |p|
paths.flat_map do |p|
path = Pathname(p)
if path.directory?
all_files_under(*path.children)
elsif path.file?
path
end
end.flatten.compact
end.compact
end
# Given a source path (referenced either absolutely or relatively)