提交 fe013ce9 编写于 作者: J Jeremy Kemper

Fix performance regression

上级 78af2710
...@@ -204,7 +204,7 @@ def load! ...@@ -204,7 +204,7 @@ def load!
private private
def valid_extension?(extension) def valid_extension?(extension)
Template.template_handler_extensions.include?(extension) !Template.registered_template_handler(extension).nil?
end end
def find_full_path(path, load_paths) def find_full_path(path, load_paths)
......
...@@ -32,13 +32,17 @@ def template_handler_extensions ...@@ -32,13 +32,17 @@ def template_handler_extensions
@@template_handlers.keys.map(&:to_s).sort @@template_handlers.keys.map(&:to_s).sort
end end
def registered_template_handler(extension)
extension && @@template_handlers[extension.to_sym]
end
def register_default_template_handler(extension, klass) def register_default_template_handler(extension, klass)
register_template_handler(extension, klass) register_template_handler(extension, klass)
@@default_template_handlers = klass @@default_template_handlers = klass
end end
def handler_class_for_extension(extension) def handler_class_for_extension(extension)
(extension && @@template_handlers[extension.to_sym]) || @@default_template_handlers registered_template_handler(extension) || @@default_template_handlers
end end
end end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册