mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-30 09:18:11 -05:00
document: revert comparison of Documents to old style & add nil check
@envygeeks, this should address your comment: fcce0d5482 (commitcomment-15162261)
This commit is contained in:
@@ -356,11 +356,9 @@ module Jekyll
|
||||
# equal or greater than the other doc's path. See String#<=> for more details.
|
||||
def <=>(other)
|
||||
return ArgumentError.new("document cannot be compared against #{other}") unless other.respond_to?(:data)
|
||||
if data['date'] && other.data['date'] && (cmp = data['date'] <=> other.data['date']) != 0
|
||||
cmp
|
||||
else
|
||||
path <=> other.path
|
||||
end
|
||||
cmp = data['date'] <=> other.data['date']
|
||||
cmp = path <=> other.path if cmp.nil? || cmp == 0
|
||||
cmp
|
||||
end
|
||||
|
||||
# Determine whether this document should be written.
|
||||
|
||||
Reference in New Issue
Block a user