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. # This path can be affected by proxy callbacks.
# @return [String] # @return [String]
def destination_path def destination_path
# TODO: memoize this value # memoizing this means that reroute callbacks should be in place before the sitemap
store.reroute_callbacks.inject(self.path) do |destination, callback| # gets built
@destination_path ||= store.reroute_callbacks.inject(self.path) do |destination, callback|
callback.call(destination, self) callback.call(destination, self)
end end
end end