1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_view/template/text.rb
José Valim b2600bfc18 Remove locals dependency from template.
This means that templates does not need to store its source anymore, allowing us to reduce the ammount of memory taken by our Rails processes. Naively speaking, if your app/views contains 2MB of files, each of your processes (after being hit by a bunch of requests) will take 2MB less of memory after this commit.

This is extremely important for the upcoming features. Since Rails will also render CSS and JS files, their source won't be stored as well allowing us to decrease the ammount of memory taken.
2010-10-07 21:31:31 +02:00

30 lines
555 B
Ruby

module ActionView #:nodoc:
# = Action View Text Template
class Template
class Text < String #:nodoc:
attr_accessor :mime_type
def initialize(string, mime_type = nil)
super(string.to_s)
@mime_type = Mime[mime_type] || mime_type if mime_type
@mime_type ||= Mime::TEXT
end
def identifier
'text template'
end
def inspect
'text template'
end
def render(*args)
to_s
end
def formats
[@mime_type.to_sym]
end
end
end
end