From ad8f32e4d74b308a98199885e6f83ff7c717c713 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sat, 29 Mar 2008 03:51:29 +0100 Subject: [PATCH] feed-next-prev darcs-hash:20080329025129-ce558-c91b48dd408982c6aa282e98dd3c6ef41695b72e.gz --- lib/atom/feed.rb | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/atom/feed.rb b/lib/atom/feed.rb index 093c51d..314dc8e 100644 --- a/lib/atom/feed.rb +++ b/lib/atom/feed.rb @@ -192,30 +192,19 @@ def update! coll = self.class.parse(coll.root, self.base.to_s) merge! coll - if nl = next_link - abs_uri = @uri + nl["href"] + if abs_uri = next_link @next = self.class.new(abs_uri.to_s, @http) end - if pl = previous_link - abs_uri = @uri + pl["href"] + if abs_uri = previous_link @prev = self.class.new(abs_uri.to_s, @http) end self end - def previous_link - links.find do |l| - l.rel == "previous" and l.type.match(/^application\/atom\+xmll/) - end - end - - def next_link - links.find do |l| - l.rel == "next" and l.type.match(/^application\/atom\+xmll/) - end - end + atom_link :previous_link, :rel => 'previous' + atom_link :next_link, :rel => 'next' # adds an entry to this feed. if this feed already contains an # entry with the same id, the newest one is used.