Memoize Sitemap::Page#destination_path

This commit is contained in:
Ben Hollis 2012-02-09 09:39:24 -08:00
parent fdbd301a32
commit d483d8bc54

View file

@ -192,8 +192,9 @@ module Middleman::Sitemap
# This path can be affected by proxy callbacks.
# @return [String]
def destination_path
# TODO: memoize this value
store.reroute_callbacks.inject(self.path) do |destination, callback|
# memoizing this means that reroute callbacks should be in place before the sitemap
# gets built
@destination_path ||= store.reroute_callbacks.inject(self.path) do |destination, callback|
callback.call(destination, self)
end
end