Class: Perron::Site::Builder::Feeds

Inherits:
Object
  • Object
show all
Defined in:
lib/perron/site/builder/feeds.rb,
lib/perron/site/builder/feeds/rss.rb,
lib/perron/site/builder/feeds/atom.rb,
lib/perron/site/builder/feeds/json.rb,
lib/perron/site/builder/feeds/author.rb,
lib/perron/site/builder/feeds/template.rb

Defined Under Namespace

Modules: Author, Template Classes: Atom, Json, Rss

Instance Method Summary collapse

Constructor Details

#initialize(output_path) ⇒ Feeds

Returns a new instance of Feeds.



11
12
13
# File 'lib/perron/site/builder/feeds.rb', line 11

def initialize(output_path)
  @output_path = output_path
end

Instance Method Details

#generateObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/perron/site/builder/feeds.rb', line 15

def generate
  Perron::Site.collections.each do |collection|
    next if collection.configuration.blank?

    config = collection.configuration.feeds

    if config.atom.enabled
      create_file at: config.atom.path, with: Atom.new(collection: collection).generate
    end

    if config.json.enabled
      create_file at: config.json.path, with: Json.new(collection: collection).generate
    end

    if config.rss.enabled
      create_file at: config.rss.path, with: Rss.new(collection: collection).generate
    end
  end
end