Class: Aardi::ATOMFeed

Inherits:
AbstractFeed show all
Defined in:
lib/aardi/atom_feed.rb

Instance Attribute Summary

Attributes inherited from AbstractBlog

#key

Instance Method Summary collapse

Methods inherited from AbstractFeed

#initialize, #render, #target_path

Methods inherited from AbstractBlog

#metadata, #mtime, #render

Constructor Details

This class inherits a constructor from Aardi::AbstractFeed

Instance Method Details

#contentObject



5
6
7
8
9
10
11
12
13
# File 'lib/aardi/atom_feed.rb', line 5

def content
  atom_feed = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do
    feed('xmlns' => 'http://www.w3.org/2005/Atom') do |feed|
      feed_details(feed)
    end
  end

  atom_feed.to_xml
end

#feed_details(feed) ⇒ Object

:reek:TooManyStatements rubocop:disable Metrics/MethodLength



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/aardi/atom_feed.rb', line 17

def feed_details(feed)
  aardi_config = Aardi.config

  feed.author do
    name(aardi_config[:site_author])
  end

  subnodes = { id: feed_url, link: { href: feed_url, rel: 'self' },
               title: aardi_config[:site_title], updated: updated.iso8601 }

  subnodes.each do |node, value|
    feed.public_send node, value
  end

  @posts.each do |post|
    post_details(post, feed)
  end
end