cache matched defaults sets for given parameters (#6888)

Merge pull request 6888
This commit is contained in:
Ashwin Maroli 2018-09-19 17:16:39 +05:30 committed by jekyllbot
parent a0dc346e6c
commit 352133f39b
1 changed files with 6 additions and 2 deletions

View File

@ -188,8 +188,12 @@ module Jekyll
#
# Returns an array of hashes
def matching_sets(path, type)
valid_sets.select do |set|
!set.key?("scope") || applies?(set["scope"], path, type)
@matched_set_cache ||= {}
@matched_set_cache[path] ||= {}
@matched_set_cache[path][type] ||= begin
valid_sets.select do |set|
!set.key?("scope") || applies?(set["scope"], path, type)
end
end
end