Use flat_map instead of map.flatten

This commit is contained in:
Parker Moore 2014-10-22 00:57:06 -07:00
parent 95e96a0f83
commit b9c4fc93d7
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ module Jekyll
# #
# Returns a Set with the directory paths # Returns a Set with the directory paths
def new_dirs def new_dirs
new_files.map { |file| parent_dirs(file) }.flatten.to_set new_files.flat_map { |file| parent_dirs(file) }.to_set
end end
# Private: The list of parent directories of a given file # Private: The list of parent directories of a given file
@ -76,7 +76,7 @@ module Jekyll
# #
# Returns a Set with the directory paths # Returns a Set with the directory paths
def keep_dirs def keep_dirs
site.keep_files.map{|file| parent_dirs(File.join(site.dest, file))}.flatten.to_set site.keep_files.flat_map { |file| parent_dirs(File.join(site.dest, file)) }.to_set
end end
# Private: Creates a regular expression from the config's keep_files array # Private: Creates a regular expression from the config's keep_files array