Lookup a template class for the given filename or file extension. Return nil when no implementation is found.
# File lib/tilt.rb, line 35 def self.[](file) pattern = file.to_s.downcase unless registered?(pattern) pattern = File.basename(pattern) pattern.sub!(/^[^.]*\.?/, '') until (pattern.empty? || registered?(pattern)) end @template_mappings[pattern] end
Hash of template path pattern => template implementation class mappings.
# File lib/tilt.rb, line 8 def self.mappings @template_mappings end
Create a new template for the given file using the file's extension to determine the the template mapping.
# File lib/tilt.rb, line 25 def self.new(file, line=nil, options={}, &block) if template_class = self[file] template_class.new(file, line, options, &block) else fail "No template engine registered for #{File.basename(file)}" end end
Generated with the Darkfish Rdoc Generator 2.