Class: Aerogel::Mailer::Definition::TemplateNameCache

Inherits:
Object
  • Object
show all
Defined in:
lib/aerogel/mailer/definition.rb

Class Method Summary collapse

Class Method Details

.clearObject



126
127
128
# File 'lib/aerogel/mailer/definition.rb', line 126

def self.clear
  @cache = {}
end

.fetch(filename) ⇒ Object

Returns template file name, use cached file name if possible.



115
116
117
118
119
120
121
122
123
124
# File 'lib/aerogel/mailer/definition.rb', line 115

def self.fetch( filename )
  @cache ||= {} # reset if reload templates is used
  return @cache[filename] unless @cache[filename].nil?
  if Aerogel.get_resource( :views, filename+".erb" )
    @cache[filename] = filename.to_sym
  else
    @cache[filename] = false # template not found
  end
  @cache[filename]
end