Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Optimize Site#each_site_file (#9187)" #9357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jekyll/site.rb
Expand Up @@ -363,6 +363,7 @@ def each_site_file
pages.each { |page| yield page }
static_files.each { |file| yield(file) if file.write? }
collections.each_value { |coll| coll.docs.each { |doc| yield(doc) if doc.write? } }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have a lower cyclomatic complexity, what do you think?

 collections.each_value do  |coll| 
   if doc.write?
     coll.docs.each(&method(:yield))
     coll.files.each(&method(:yield)) 
  end
end

collections.each_value { |coll| coll.files.each { |doc| yield(doc) if doc.write? } }
end

# Returns the FrontmatterDefaults or creates a new FrontmatterDefaults
Expand Down