Hash#each_key instead of Hash#keys.each. Faster code.

This commit is contained in:
Glauco Custódio 2014-10-20 10:10:29 -02:00
parent 4b4a46579a
commit 68c0e8f847
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ module Jekyll
def deep_merge_hashes(master_hash, other_hash) def deep_merge_hashes(master_hash, other_hash)
target = master_hash.dup target = master_hash.dup
other_hash.keys.each do |key| other_hash.each_key do |key|
if other_hash[key].is_a? Hash and target[key].is_a? Hash if other_hash[key].is_a? Hash and target[key].is_a? Hash
target[key] = Utils.deep_merge_hashes(target[key], other_hash[key]) target[key] = Utils.deep_merge_hashes(target[key], other_hash[key])
next next

View File

@ -122,7 +122,7 @@ module Jekyll
def generate(site) def generate(site)
if site.layouts.key? 'category_index' if site.layouts.key? 'category_index'
dir = site.config['category_dir'] || 'categories' dir = site.config['category_dir'] || 'categories'
site.categories.keys.each do |category| site.categories.each_key do |category|
site.pages << CategoryPage.new(site, site.source, File.join(dir, category), category) site.pages << CategoryPage.new(site, site.source, File.join(dir, category), category)
end end
end end