Document two methods, simplify one of the methods (#7270)

Merge pull request 7270
This commit is contained in:
Grzegorz Kaczorek 2018-09-24 18:31:36 +02:00 committed by jekyllbot
parent 5267e0b215
commit 8a7ecfce36
1 changed files with 8 additions and 1 deletions

View File

@ -60,12 +60,19 @@ module Jekyll
data data
end end
# Returns the document date. If metadata is not present then calculates it
# based on Jekyll::Site#time or the document file modification time.
#
# Return document date string.
def date def date
data["date"] ||= (draft? ? source_file_mtime : site.time) data["date"] ||= (draft? ? source_file_mtime : site.time)
end end
# Return document file modification time in the form of a Time object.
#
# Return document file modification Time object.
def source_file_mtime def source_file_mtime
@source_file_mtime ||= File.mtime(path) File.mtime(path)
end end
# Returns whether the document is a draft. This is only the case if # Returns whether the document is a draft. This is only the case if