提交 c5e73b89 编写于 作者: Y Yehuda Katz

Reduce TextTemplate cost for simple cases

上级 0b2dd7af
......@@ -24,6 +24,7 @@ def #{method}(*args)
LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? }
def self.[](type)
return type if type.is_a?(Type)
Type.lookup_by_extension(type.to_s)
end
......
module ActionView #:nodoc:
class TextTemplate < String #:nodoc:
def initialize(string, content_type = Mime[:html])
HTML = Mime[:html]
def initialize(string, content_type = HTML)
super(string.to_s)
@content_type = Mime[content_type] || content_type
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册