From 1afbe9967d561fdcd5784382cac87f67d432a351 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 26 Dec 2015 12:23:21 -0500 Subject: [PATCH] document: return nil if bad arg in #<=> Addresses @envygeek's comment: https://github.com/jekyll/jekyll/commit/233589e15076c41ac4b95ad6e0595f2f6a4a7ac2#commitcomment-15164178 --- lib/jekyll/document.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 8c1b77cf..14a0a92e 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -355,7 +355,7 @@ module Jekyll # Returns -1, 0, +1 or nil depending on whether this doc's path is less than, # 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) + return nil unless other.respond_to?(:data) cmp = data['date'] <=> other.data['date'] cmp = path <=> other.path if cmp.nil? || cmp == 0 cmp