From c63b51b6612a0bb867a69dff2aa38d66a08eb2a4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 25 Dec 2015 22:54:12 -0500 Subject: [PATCH] document: revert comparison of Documents to old style & add nil check @envygeeks, this should address your comment: https://github.com/jekyll/jekyll/commit/fcce0d5482e6cd541e3e6857cad00a6969a9dd4e#commitcomment-15162261 --- lib/jekyll/document.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index a1bf6bad..8c1b77cf 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -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.