lib/tilt.rb in tilt-1.3 vs lib/tilt.rb in tilt-1.3.1

- old
+ new

@@ -1,7 +1,7 @@ module Tilt - VERSION = '1.3' + VERSION = '1.3.1' @preferred_mappings = Hash.new @template_mappings = Hash.new { |h, k| h[k] = [] } # Hash of template path pattern => template implementation class mappings. @@ -15,13 +15,11 @@ # Register a template implementation by file extension. def self.register(template_class, *extensions) if template_class.respond_to?(:to_str) # Support register(ext, template_class) too - ext = template_class - template_class = extensions[0] - extensions = [ext] + extensions, template_class = [template_class], extensions[0] end extensions.each do |ext| ext = normalize(ext) mappings[ext].unshift(template_class).uniq! @@ -74,11 +72,11 @@ pattern = File.basename(pattern) pattern.sub!(/^[^.]*\.?/, '') end # Try to find a preferred engine. - klass = @preferred_mappings[pattern] - return klass if klass + preferred_klass = @preferred_mappings[pattern] + return preferred_klass if preferred_klass # Fall back to the general list of mappings. klasses = @template_mappings[pattern] # Try to find an engine which is already loaded.