Reduce array allocations from `StaticFile#path` (#8083)

Merge pull request 8083
This commit is contained in:
Ashwin Maroli 2020-03-30 20:14:04 +05:30 committed by GitHub
parent 539e712c41
commit f0ab09968e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -40,6 +40,7 @@ module Jekyll
# Returns source file path. # Returns source file path.
def path def path
@path ||= begin
# Static file is from a collection inside custom collections directory # Static file is from a collection inside custom collections directory
if !@collection.nil? && !@site.config["collections_dir"].empty? if !@collection.nil? && !@site.config["collections_dir"].empty?
File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact) File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact)
@ -47,6 +48,7 @@ module Jekyll
File.join(*[@base, @dir, @name].compact) File.join(*[@base, @dir, @name].compact)
end end
end end
end
# Obtain destination path. # Obtain destination path.
# #