Skip to content

Commit

Permalink
feed-next-prev
Browse files Browse the repository at this point in the history
darcs-hash:20080329025129-ce558-c91b48dd408982c6aa282e98dd3c6ef41695b72e.gz
  • Loading branch information
bct committed Mar 29, 2008
1 parent d8acab8 commit ad8f32e
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions lib/atom/feed.rb
Expand Up @@ -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.
Expand Down

0 comments on commit ad8f32e

Please sign in to comment.