Initialize and reset glob_cache only as necessary (#7658)

Merge pull request 7658
This commit is contained in:
Ashwin Maroli 2019-05-15 21:19:05 +05:30 committed by jekyllbot
parent d6a756ba27
commit c47611cb6e
1 changed files with 2 additions and 2 deletions

View File

@ -10,11 +10,10 @@ module Jekyll
# Initializes a new instance. # Initializes a new instance.
def initialize(site) def initialize(site)
@site = site @site = site
reset
end end
def reset def reset
@glob_cache = {} @glob_cache = {} if @glob_cache
end end
def update_deprecated_types(set) def update_deprecated_types(set)
@ -130,6 +129,7 @@ module Jekyll
end end
def glob_cache(path) def glob_cache(path)
@glob_cache ||= {}
@glob_cache[path] ||= Dir.glob(path) @glob_cache[path] ||= Dir.glob(path)
end end