Extracted each method

This commit is contained in:
John Piasetzki 2013-05-26 16:15:24 -04:00
parent b5d4a96149
commit 13fd798ec0
1 changed files with 10 additions and 6 deletions

View File

@ -240,9 +240,7 @@ module Jekyll
# files to be written
files = Set.new
[self.posts, self.pages, self.static_files].flatten.each do |item|
files << item.destination(self.dest)
end
site_files_each { |item| files << item.destination(self.dest) }
# adding files' parent directories
dirs = Set.new
@ -269,9 +267,7 @@ module Jekyll
#
# Returns nothing.
def write
[self.posts, self.pages, self.static_files].flatten.each do |item|
item.write(self.dest)
end
site_files_each { |item| item.write(self.dest) }
end
# Construct a Hash of Posts indexed by the specified Post attribute.
@ -404,6 +400,14 @@ module Jekyll
end
end
def site_files_each
%w(posts pages static_files).each do |type|
self.send(type).each do |item|
yield item
end
end
end
private
def has_yaml_header?(file)