From f14af82da5384a262d0e7656fce36de1e485698e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 10 Apr 2015 16:31:19 -0400 Subject: [PATCH] static_file: extract extname in initializer and save as variable. #3632 --- lib/jekyll/static_file.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index fccd8b70..0ab88cbd 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -3,7 +3,7 @@ module Jekyll # The cache of last modification times [path] -> mtime. @@mtimes = Hash.new - attr_reader :relative_path + attr_reader :relative_path, :extname # Initialize a new StaticFile. # @@ -18,6 +18,7 @@ module Jekyll @name = name @collection = collection @relative_path = File.join(*[@dir, @name].compact) + @extname = File.extname(@relative_path) end # Returns source file path. @@ -92,7 +93,7 @@ module Jekyll { "path" => File.join("", relative_path), "modified_time" => mtime.to_s, - "extname" => File.extname(relative_path) + "extname" => extname } end end