Simplify populating the sitemap lookup cache
This commit is contained in:
parent
9024de85d8
commit
9be76da3cf
|
@ -53,11 +53,10 @@ module Middleman::Sitemap
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reset lookup cache
|
# Reset lookup cache
|
||||||
cache_structure = { :path => {}, :destination_path => {} }
|
@_lookup_cache = { :path => {}, :destination_path => {} }
|
||||||
@_lookup_cache = @resources.inject(cache_structure) do |cache, resource|
|
@resources.each do |resource|
|
||||||
cache[:path][resource.path] = resource
|
@_lookup_cache[:path][resource.path] = resource
|
||||||
cache[:destination_path][resource.destination_path] = resource
|
@_lookup_cache[:destination_path][resource.destination_path] = resource
|
||||||
cache
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,4 +187,4 @@ module Middleman::Sitemap
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue