2009-03-20 19:13:13 -04:00
|
|
|
module ActionView #:nodoc:
|
2010-06-20 16:26:31 -04:00
|
|
|
# = Action View Text Template
|
2009-12-02 23:01:01 -05:00
|
|
|
class Template
|
|
|
|
class Text < String #:nodoc:
|
2010-03-12 14:39:53 -05:00
|
|
|
attr_accessor :mime_type
|
|
|
|
|
|
|
|
def initialize(string, mime_type = nil)
|
2009-12-02 23:01:01 -05:00
|
|
|
super(string.to_s)
|
2010-03-12 14:39:53 -05:00
|
|
|
@mime_type = Mime[mime_type] || mime_type if mime_type
|
|
|
|
@mime_type ||= Mime::TEXT
|
2009-12-02 23:01:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def identifier
|
2010-01-12 18:41:04 -05:00
|
|
|
'text template'
|
2009-12-02 23:01:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def inspect
|
|
|
|
'text template'
|
|
|
|
end
|
|
|
|
|
|
|
|
def render(*args)
|
|
|
|
to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def formats
|
2010-03-12 14:39:53 -05:00
|
|
|
[@mime_type.to_sym]
|
2009-12-02 23:01:01 -05:00
|
|
|
end
|
2009-09-24 13:30:13 -04:00
|
|
|
end
|
2009-03-20 19:13:13 -04:00
|
|
|
end
|
|
|
|
end
|