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:
parent
debdb15171
commit
c63b51b661
|
@ -356,11 +356,9 @@ module Jekyll
|
||||||
# equal or greater than the other doc's path. See String#<=> for more details.
|
# equal or greater than the other doc's path. See String#<=> for more details.
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
return ArgumentError.new("document cannot be compared against #{other}") unless other.respond_to?(:data)
|
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 = data['date'] <=> other.data['date']
|
||||||
cmp
|
cmp = path <=> other.path if cmp.nil? || cmp == 0
|
||||||
else
|
cmp
|
||||||
path <=> other.path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine whether this document should be written.
|
# Determine whether this document should be written.
|
||||||
|
|
Loading…
Reference in New Issue