module Padrino::Rendering::ClassMethods

def cache_template_file!(template_file, render_options)

Parameters:
  • render_options (Array) --
  • template_file (String) --
def cache_template_file!(template_file, render_options)
  (@_cached_templates ||= {})[render_options] = template_file || []
end

def fetch_layout_path(given_layout=nil)

Parameters:
  • given_layout (Symbol, nil) --
def fetch_layout_path(given_layout=nil)
  layout_name = given_layout || @layout || :application
  @_cached_layout ||= {}
  cached_layout_path = @_cached_layout[layout_name]
  return cached_layout_path if cached_layout_path
  has_layout_at_root = Dir["#{views}/#{layout_name}.*"].any?
  layout_path = has_layout_at_root ? layout_name.to_sym : File.join('layouts', layout_name.to_s).to_sym
  @_cached_layout[layout_name] = layout_path unless reload_templates?
  layout_path
end

def fetch_template_file(render_options)

Parameters:
  • render_options (Array) --
def fetch_template_file(render_options)
  (@_cached_templates ||= {})[render_options]
end

def layout(name=:layout, &block)

Other tags:
    Yield: - []

Parameters:
  • name (Symbol) -- (:layout)
def layout(name=:layout, &block)
  return super(name, &block) if block_given?
  @layout = name
end