Module: Card::Set::All::Rss::RssFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb
Instance Attribute Summary collapse
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(card, args) ⇒ Object
-
#pub_date ⇒ Object
-
#raw_feed_items ⇒ Object
-
#show(view, args) ⇒ Object
-
#view: closed ⇒ Object
-
#view: comment_box ⇒ Object
-
#view: content ⇒ Object
-
#view: feed ⇒ Object
FIXME: integrate this with common XML features when it is added.
-
#view: feed_body ⇒ Object
-
#view: feed_description ⇒ Object
-
#view: feed_item ⇒ Object
-
#view: feed_item_description ⇒ Object
-
#view: feed_title ⇒ Object
-
#view: menu ⇒ Object
-
#view: open ⇒ Object
-
#view: open_content ⇒ Object
Instance Attribute Details
#xml ⇒ Object
Returns the value of attribute xml.
11 12 13 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 11 def xml @xml end |
Instance Method Details
#initialize(card, args) ⇒ Object
13 14 15 16 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 13 def initialize card, args super @xml = @parent ? @parent.xml : ::Builder::XmlMarkup.new end |
#pub_date ⇒ Object
68 69 70 71 72 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 68 def pub_date (card.updated_at || Time.zone.now).to_s(:rfc822) # updated_at fails on virtual # cards, because not all to_s's take args (just actual dates) end |
#raw_feed_items ⇒ Object
43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 43 def raw_feed_items [card] end |
#show(view, args) ⇒ Object
18 19 20 21 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 18 def show view, args view ||= :feed render! view, args end |
#view: closed ⇒ Object
85 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 85 view :closed, :link, mod: All::Base::Format |
#view: comment_box ⇒ Object
79 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 79 view(:comment_box) { "" } |
#view: content ⇒ Object
83 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 83 view :content, :core, mod: All::Base::Format |
#view: feed ⇒ Object
FIXME: integrate this with common XML features when it is added
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 24 view :feed, cache: :never do return "RSS feeds disabled" unless Cardio.config.rss_enabled begin @xml.instruct! :xml, version: "1.0", standalone: "yes" @xml.rss version: "2.0", "xmlns:content" => "http://purl.org/rss/1.0/modules/content/" do @xml.channel do @xml.title render_feed_title @xml.description render_feed_description @xml.link render_url render_feed_body end end rescue StandardError => e @xml.error "\n\nERROR rendering RSS: #{e.inspect}\n\n #{e.backtrace}" end end |
#view: feed_body ⇒ Object
47 48 49 50 51 52 53 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 47 view :feed_body, cache: :never do raw_feed_items.each do |item| @xml.item do subformat(item).render! :feed_item end end end |
#view: feed_description ⇒ Object
78 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 78 view(:feed_description) { "" } |
#view: feed_item ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 59 view :feed_item do @xml.title card.name add_name_context @xml.description render_feed_item_description @xml.pubDate pub_date @xml.link render_url @xml.guid render_url end |
#view: feed_item_description ⇒ Object
74 75 76 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 74 view :feed_item_description do render_open_content end |
#view: feed_title ⇒ Object
55 56 57 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 55 view :feed_title do "#{Card::Rule.global_setting(:title)} : #{card.name.gsub(/^\*/, '')}" end |
#view: menu ⇒ Object
80 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/rss.rb', line 80 view(:menu) { "" } |