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

Inherits:
Object
  • Object
show all
Includes:
Author, Template
Defined in:
lib/perron/site/builder/feeds/json.rb

Instance Method Summary collapse

Methods included from Template

#current_feed_url, #feed_configuration, #find_template, #render, #routes, #url_for_resource

Constructor Details

#initialize(collection:) ⇒ Json

Returns a new instance of Json.



14
15
16
17
# File 'lib/perron/site/builder/feeds/json.rb', line 14

def initialize(collection:)
  @collection = collection
  @configuration = Perron.configuration
end

Instance Method Details

#generateObject



19
20
21
22
23
24
25
26
# File 'lib/perron/site/builder/feeds/json.rb', line 19

def generate
  return if resources.empty?

  template = find_template("json")
  return unless template

  render(template, feed_configuration)
end