From 9be76da3cf578d2f17cd082bac6acd3c231132dc Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Wed, 18 Apr 2012 00:15:02 -0700 Subject: [PATCH] Simplify populating the sitemap lookup cache --- middleman-core/lib/middleman-core/sitemap/store.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index d6ba9fb5..eecb64e3 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -53,11 +53,10 @@ module Middleman::Sitemap end # Reset lookup cache - cache_structure = { :path => {}, :destination_path => {} } - @_lookup_cache = @resources.inject(cache_structure) do |cache, resource| - cache[:path][resource.path] = resource - cache[:destination_path][resource.destination_path] = resource - cache + @_lookup_cache = { :path => {}, :destination_path => {} } + @resources.each do |resource| + @_lookup_cache[:path][resource.path] = resource + @_lookup_cache[:destination_path][resource.destination_path] = resource end end @@ -188,4 +187,4 @@ module Middleman::Sitemap path end end -end \ No newline at end of file +end