lib/jekyll-feed/generator.rb in jekyll-feed-0.9.2 vs lib/jekyll-feed/generator.rb in jekyll-feed-0.9.3
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module JekyllFeed
class Generator < Jekyll::Generator
safe true
priority :lowest
@@ -27,11 +29,11 @@
end
end
# Path to feed.xml template file
def feed_source_path
- File.expand_path "./feed.xml", File.dirname(__FILE__)
+ File.expand_path "feed.xml", __dir__
end
# Checks if a file already exists in the site source
def file_exists?(file_path)
if @site.respond_to?(:in_source_dir)
@@ -41,10 +43,10 @@
end
end
# Generates contents for a file
def content_for_file(file_path, file_source_path)
- file = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", file_path)
+ file = PageWithoutAFile.new(@site, __dir__, "", file_path)
file.content = File.read(file_source_path).gsub(MINIFY_REGEX, "")
file.data["layout"] = nil
file.data["sitemap"] = false
file.data["xsl"] = file_exists?("feed.xslt.xml")
file.output