Method: Padrino::Rendering::ClassMethods#cache_template_path

Defined in:
padrino-helpers/lib/padrino/rendering.rb

#cache_template_path(options) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
# File 'padrino-helpers/lib/padrino/rendering.rb', line 130

def cache_template_path(options)
  began_at = Time.now
  @_cached_templates ||= {}
  logging = defined?(settings) && settings.logging? && defined?(logger)
  if !reload_templates? && path = @_cached_templates[options]
    logger.debug :cached, began_at, path[0] if logging
  else
    path = @_cached_templates[options] = yield(name)
    logger.debug :template, began_at, path[0] if path && logging
  end
  path
end