Class: Nwiki::Frontend::Feed
- Inherits:
-
Object
- Object
- Nwiki::Frontend::Feed
- Defined in:
- lib/nwiki/frontend/app/feed.rb
Instance Attribute Summary collapse
-
#articles_path ⇒ Object
readonly
Returns the value of attribute articles_path.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(git_repo_path, opts = {}) ⇒ Feed
constructor
A new instance of Feed.
Constructor Details
Instance Attribute Details
#articles_path ⇒ Object (readonly)
Returns the value of attribute articles_path.
6 7 8 |
# File 'lib/nwiki/frontend/app/feed.rb', line 6 def articles_path @articles_path end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/nwiki/frontend/app/feed.rb', line 13 def call env [ 200, { 'Content-Type' => "application/atom+xml; charset=#{Nwiki::Core::Wiki.repo_filename_encoding}" }, [ RSS::Maker.make('atom') { |maker| maker.channel.title = @wiki.title maker.channel.description = @wiki.subtitle maker.channel.link = Rack::Request.new(env).url maker.channel. = @wiki. maker.channel.date = @wiki.log.max_by(&:time).time maker.channel.id = Rack::Request.new(env).url maker.items.do_sort = true maker.items.max_size = 50 @wiki.log.each do |diff| path = Nwiki::Core::Wiki.canonicalize_path(diff.path) next if path =~ /\.gif|png|jpg$/ # FIXME Don't display binary file at feed path.gsub!(/\.org$/, '') maker.items.new_item do |item| item.link = Rack::Request.new(env).url.gsub(Regexp.new(Rack::Request.new(env).fullpath), "#{articles_path}/#{path}") item.title = path item.date = diff.time end end }.to_s ] ] end |