mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Reduce TextTemplate cost for simple cases
This commit is contained in:
parent
0b2dd7afd9
commit
c5e73b8976
2 changed files with 4 additions and 1 deletions
|
@ -24,6 +24,7 @@ module Mime
|
|||
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
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue