Skip to content

Commit

Permalink
Memoize the config.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancribbs committed Sep 30, 2008
1 parent e6e2987 commit 97677d7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/mailer_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ module MailerTags
include Radiant::Taggable

def config
page = self
until page.part(:mailer) or (not page.parent)
page = page.parent
@config ||= begin
page = self
until page.part(:mailer) or (not page.parent)
page = page.parent
end
string = page.render_part(:mailer)
(string.empty? ? {} : YAML::load(string))
end
string = page.render_part(:mailer)
(string.empty? ? {} : YAML::load(string))
end

desc %{ All mailer-related tags live inside this one. }
Expand Down

0 comments on commit 97677d7

Please sign in to comment.