lib/action_view/template/text.rb in actionpack-3.2.22.5 vs lib/action_view/template/text.rb in actionpack-4.0.0.beta1
- old
+ new
@@ -1,30 +1,34 @@
module ActionView #:nodoc:
# = Action View Text Template
class Template
- class Text < String #:nodoc:
- attr_accessor :mime_type
+ class Text #:nodoc:
+ attr_accessor :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
+ def initialize(string, type = nil)
+ @string = string.to_s
+ @type = Types[type] || type if type
+ @type ||= Types[:text]
end
def identifier
'text template'
end
def inspect
'text template'
end
+ def to_str
+ @string
+ end
+
def render(*args)
- to_s
+ to_str
end
def formats
- [@mime_type.respond_to?(:ref) ? @mime_type.ref : @mime_type.to_s]
+ [@type.to_sym]
end
end
end
end