From 24aabbe05f0ceb97a9fc496f843a640f4c8b3e9b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 22 Apr 2013 12:57:52 +0200 Subject: [PATCH] Moving comparison for PostUrl tag to the PostComparer class --- lib/jekyll/tags/post_url.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 6dbec9be..dd02d3bf 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -10,6 +10,13 @@ module Jekyll @slug = slug @date = Time.parse(date) end + + def ==(other) + slug == other.slug && + date.year == other.date.year && + date.month == other.date.month && + date.day == other.date.day + end end class PostUrl < Liquid::Tag @@ -23,11 +30,7 @@ module Jekyll site = context.registers[:site] site.posts.each do |p| - if p.slug == @post.slug \ - and p.date.year == @post.date.year \ - and p.date.month == @post.date.month \ - and p.date.day == @post.date.day - + if @post == p return p.url end end