Don’t render layouts for templates with the given extensions.
# File 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
# File 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
# File 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
# File lib/action_view/template.rb, line 153 def content_type format.gsub('.', '/') end
# File lib/action_view/template.rb, line 184 def exempt_from_layout? @@exempt_from_layout.any? { |exempted| path =~ exempted } end
# File 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
# File lib/action_view/template.rb, line 144 def format_and_extension (extensions = [format, extension].compact.join(".")).blank? ? nil : extensions end
# File lib/action_view/template.rb, line 199 def method_segment relative_path.to_s.gsub(/([^a-zA-Z0-9_])/) { $1.ord } end
# File lib/action_view/template.rb, line 157 def mime_type Mime::Type.lookup_by_extension(format) if format && defined?(::Mime) end
# File lib/action_view/template.rb, line 149 def multipart? format && format.include?('.') end
# File lib/action_view/template.rb, line 162 def path [base_path, [name, locale, format, extension].compact.join('.')].compact.join('/') end
# File lib/action_view/template.rb, line 167 def path_without_extension [base_path, [name, locale, format].compact.join('.')].compact.join('/') end
# File lib/action_view/template.rb, line 172 def path_without_format_and_extension [base_path, [name, locale].compact.join('.')].compact.join('/') end
# File 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
# File 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
Generated with the Darkfish Rdoc Generator 2.