Replace redundant Array#map with Array#each (#7761)

Merge pull request 7761
This commit is contained in:
Ashwin Maroli 2019-07-25 22:05:30 +05:30 committed by jekyllbot
parent 882279c307
commit 1795996458
1 changed files with 4 additions and 5 deletions

View File

@ -9,14 +9,13 @@ module Jekyll
@unfiltered_content = [] @unfiltered_content = []
end end
# Read all the files in <source>/<dir>/ for Yaml header and create a new Page # Create a new `Jekyll::Page` object for each entry in a given array.
# object for each file.
# #
# dir - The String relative path of the directory to read. # files - An array of file names inside `@dir`
# #
# Returns an array of static pages. # Returns an array of publishable `Jekyll::Page` objects.
def read(files) def read(files)
files.map do |page| files.each do |page|
@unfiltered_content << Page.new(@site, @site.source, @dir, page) @unfiltered_content << Page.new(@site, @site.source, @dir, page)
end end
@unfiltered_content.select { |page| site.publisher.publish?(page) } @unfiltered_content.select { |page| site.publisher.publish?(page) }