lib/wrapt/wrapt.rb
def template(name, opts={})
    format = opts.fetch(:format, default_format)
    template_name = template_name_and_format_glob(name,format, opts)

    return _template_cache[template_name] if _template_cache[template_name]

    file = nil
    layout_dirs.detect do |dir|
      file = Dir[File.join(dir, template_name)].first
    end

    if file.nil?
      nil
    else
      _template_cache[template_name] = Tilt.new(file)
    end
  end
# Fetches the named template with any given options
#
# @param [String|Symbol] The template name to fetch
# @param [Hash] opts
# @option opts [String|Symbol] :format Provide the format for the template that will be used
# @return [Tilt::Template|NilClass] A template file to use to render the layout
# @api public
Fetches the named template with any given options
Fetches the named template with any given options
def template(name, opts={})
    format = opts.fetch(:format, default_format)
    template_name = template_name_and_format_glob(name,format, opts)
    return _template_cache[template_name] if _template_cache[template_name]
    file = nil
    layout_dirs.detect do |dir|
      file = Dir[File.join(dir, template_name)].first
    end
    if file.nil?
      nil
    else
      _template_cache[template_name] = Tilt.new(file)
    end
  end
def template ( name , opts = { } ) format = opts . fetch ( :format , default_format ) template_name = template_name_and_format_glob ( name , format , opts ) return _template_cache [ template_name ] if _template_cache [ template_name ] file = nil layout_dirs . detect do | dir | file = Dir [ File . join ( dir , template_name ) ] . first end if file . nil? nil else _template_cache [ template_name ] = Tilt . new ( file ) end end
Fetches the named template with any given options
Fetches the named template with any given options
A template file to use to render the layout
A template file to use to render the layout
Tilt::Template|NilClass
name
opts
:format Provide the format for the template that will be used
: format Provide the format for the template that will be used
None
api
None