Namespace
Methods
A
C
E
F
L
M
N
P
R
S
Included Modules
Attributes
[RW] base_path
[RW] extension
[W] filename
[RW] format
[RW] load_path
[RW] locale
[RW] name
[RW] template_path
Class Public methods
exempt_from_layout(*extensions)

Don't render layouts for templates with the given extensions.

# File actionpack/lib/action_view/template.rb, line 104
def self.exempt_from_layout(*extensions)
  regexps = extensions.collect do |extension|
    extension.is_a?(Regexp) ? extension : /\.#{Regexp.escape(extension.to_s)}$/
  end
  @@exempt_from_layout.merge(regexps)
end
new(template_path, load_path = nil)
# File actionpack/lib/action_view/template.rb, line 116
def initialize(template_path, load_path = nil)
  @template_path, @load_path = template_path.dup, load_path
  @base_path, @name, @locale, @format, @extension = split(template_path)
  @base_path.to_s.gsub!(/\/$/, '') # Push to split method
  # Extend with partial super powers
  extend RenderablePartial if @name =~ /^_/
end
Instance Public methods
accessible_paths()
# File actionpack/lib/action_view/template.rb, line 125
def accessible_paths
  paths = []
  if valid_extension?(extension)
    paths << path
    paths << path_without_extension
    if multipart?
      formats = format.split(".")
      paths << "#{path_without_format_and_extension}.#{formats.first}"
      paths << "#{path_without_format_and_extension}.#{formats.second}"
    end
  else
    # template without explicit template handler should only be reachable through its exact path
    paths << template_path
  end
  paths
end
content_type()
# File actionpack/lib/action_view/template.rb, line 153
def content_type
  format.gsub('.', '/')
end
exempt_from_layout?()
# File actionpack/lib/action_view/template.rb, line 184
def exempt_from_layout?
  @@exempt_from_layout.any? { |exempted| path =~ exempted }
end
filename()
# File actionpack/lib/action_view/template.rb, line 188
def filename
  # no load_path means this is an "absolute pathed" template
  load_path ? File.join(load_path, template_path) : template_path
end
format_and_extension()
# File actionpack/lib/action_view/template.rb, line 144
def format_and_extension
  (extensions = [format, extension].compact.join(".")).blank? ? nil : extensions
end
load!()
# File actionpack/lib/action_view/template.rb, line 216
def load!
  freeze
end
method_segment()
# File actionpack/lib/action_view/template.rb, line 199
def method_segment
  relative_path.to_s.gsub(/([^a-zA-Z0-9_])/) { $1.ord }
end
mime_type()
# File actionpack/lib/action_view/template.rb, line 157
def mime_type
  Mime::Type.lookup_by_extension(format) if format && defined?(::Mime)
end
multipart?()
# File actionpack/lib/action_view/template.rb, line 149
def multipart?
  format && format.include?('.')
end
path()
# File actionpack/lib/action_view/template.rb, line 162
def path
  [base_path, [name, locale, format, extension].compact.join('.')].compact.join('/')
end
path_without_extension()
# File actionpack/lib/action_view/template.rb, line 167
def path_without_extension
  [base_path, [name, locale, format].compact.join('.')].compact.join('/')
end
path_without_format_and_extension()
# File actionpack/lib/action_view/template.rb, line 172
def path_without_format_and_extension
  [base_path, [name, locale].compact.join('.')].compact.join('/')
end
relative_path()
# File actionpack/lib/action_view/template.rb, line 177
def relative_path
  path = File.expand_path(filename)
  path.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}\//, '') if defined?(RAILS_ROOT)
  path
end
render_template(view, local_assigns = {})
# File actionpack/lib/action_view/template.rb, line 204
def render_template(view, local_assigns = {})
  render(view, local_assigns)
rescue Exception => e
  raise e unless filename
  if TemplateError === e
    e.sub_template_of(self)
    raise e
  else
    raise TemplateError.new(self, view.assigns, e)
  end
end
source()
# File actionpack/lib/action_view/template.rb, line 194
def source
  File.read(filename)
end