Move to flat_map now that we don't use 1.8
This commit is contained in:
parent
ac64b17ef0
commit
7f1285a773
2 changed files with 3 additions and 4 deletions
|
@ -139,15 +139,14 @@ module Middleman
|
||||||
# @param paths Some paths string or Pathname
|
# @param paths Some paths string or Pathname
|
||||||
# @return [Array] An array of filenames
|
# @return [Array] An array of filenames
|
||||||
def self.all_files_under(*paths)
|
def self.all_files_under(*paths)
|
||||||
# when we drop 1.8, replace this with flat_map
|
paths.flat_map do |p|
|
||||||
paths.map do |p|
|
|
||||||
path = Pathname(p)
|
path = Pathname(p)
|
||||||
if path.directory?
|
if path.directory?
|
||||||
all_files_under(*path.children)
|
all_files_under(*path.children)
|
||||||
elsif path.file?
|
elsif path.file?
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
end.flatten.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
# Given a source path (referenced either absolutely or relatively)
|
# Given a source path (referenced either absolutely or relatively)
|
||||||
|
|
Loading…
Add table
Reference in a new issue