class Strelka::CMS::Feeds
The Feed applet – generate RSS and Atom feeds for various things.
Constants
Attributes
catalog[R]
The PageCatalog to use for building feeds
Public Class Methods
configure( config=nil )
click to toggle source
Configurability API – configure the app.
# File lib/strelka/cms/feeds.rb, line 61 def self::configure( config=nil ) if config self.uuid = config[:uuid] self.entry_count = config[:entry_count] self.pageroot = config[:pageroot] self.paths = config[:paths] end end
new( * )
click to toggle source
Set up the feeds app.
Calls superclass method
# File lib/strelka/cms/feeds.rb, line 72 def initialize( * ) super @catalog = Strelka::CMS::PageCatalog.new( self.class.pageroot ) @site_uuid = UUID.parse( self.class.uuid ) end
Protected Instance Methods
find_newest_pages( feedpath, req )
click to toggle source
Find the newest pages for the path of the request
and return them.
# File lib/strelka/cms/feeds.rb, line 175 def find_newest_pages( feedpath, req ) self.log.debug "Looking for newest pages in feed path: %p" % [ feedpath ] finish_with HTTP::NOT_FOUND unless self.class.paths.include?( feedpath ) feedpath.untaint count = self.class.entry_count newest_pages = self.catalog.relative_to( feedpath ).sort_by( &:date ).first( count ) newest_page = newest_pages.first # Just 304 if the feed doesn't need to be updated if req.headers.if_modified_since && Time.parse(req.headers.if_modified_since) > newest_page.date self.log.info "Not modified since %s" % [ req.headers.if_modified_since ] finish_with HTTP::NOT_MODIFIED, "No changes since %s" % [ req.headers.if_modified_since ] end return newest_pages end