Sha256: a892dcdd1e224e4d21086af3afb210f0277311a983bce66410961a82e4c8a15d

Contents?: true

Size: 504 Bytes

Versions: 9

Compression:

Stored size: 504 Bytes

Contents

require 'murlsh'

module Murlsh

  # regenerate atom feed after a new url has been added
  class UpdateFeed < Plugin

    Hook = 'add_post'

    def self.run(config)
      latest = Murlsh::Url.all(:order => 'id DESC',
        :limit => config.fetch('num_posts_feed', 25))

      feed = Murlsh::AtomFeed.new(config.fetch('root_url'),
        :filename => config.fetch('feed_file'),
        :title => config.fetch('page_title', ''))

      feed.write(latest, config.fetch('feed_file'))
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
murlsh-0.5.2 plugins/update_feed.rb
murlsh-0.5.1 plugins/update_feed.rb
murlsh-0.5.0 plugins/update_feed.rb
murlsh-0.4.0 plugins/update_feed.rb
murlsh-0.3.0 plugins/update_feed.rb
murlsh-0.2.4 plugins/update_feed.rb
murlsh-0.2.3 plugins/update_feed.rb
murlsh-0.2.2 plugins/update_feed.rb
murlsh-0.2.1 plugins/update_feed.rb