Class: RSSView
- Inherits:
-
Object
- Object
- RSSView
- Defined in:
- lib/gollum/views/rss.rb
Constant Summary
Constants included from Precious::Views::RouteHelpers
Precious::Views::RouteHelpers::ROUTES
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(base_url, wiki_title, url, changes) ⇒ RSSView
constructor
A new instance of RSSView.
- #render ⇒ Object
Methods included from Precious::Views::RouteHelpers
#clean_url, included, #page_route, parse_routes
Methods included from Precious::Views::AppHelpers
Constructor Details
#initialize(base_url, wiki_title, url, changes) ⇒ RSSView
Returns a new instance of RSSView.
10 11 12 13 14 15 |
# File 'lib/gollum/views/rss.rb', line 10 def initialize(base_url, wiki_title, url, changes) @base_url = base_url @wiki_title = wiki_title @url = url @changes = changes end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/gollum/views/rss.rb', line 8 def base_url @base_url end |
Instance Method Details
#render ⇒ Object
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 |
# File 'lib/gollum/views/rss.rb', line 17 def render latest_changes = "#{@url}#{latest_changes_path}" RSS::Maker.make('2.0') do |maker| maker.channel. = 'Gollum Wiki' maker.channel.updated = @changes.first. maker.channel.title = "#{@wiki_title} Latest Changes" maker.channel.description = "Latest Changes in #{@wiki_title}" maker.channel.link = latest_changes @changes.each do |change| maker.items.new_item do |item| item.link = latest_changes item.title = change. item.updated = change. id = change.id files = change.stats.files.map do |files| [files[:old_file], files[:new_file]].compact.map do |file| f = extract_page_dir(file) "<li><a href=\"#{@url}#{page_route(f)}/#{id}\">#{f}</a></li>" end end item.description = "Commited by: <a href=\"mailto:#{change..email}\">#{change..name}</a><br/>Commit ID: #{id[0..6]}<br/><br/>Affected files:<ul>#{files.join}</ul>" end end end.to_s end |