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
|
2012-06-22 20:11:57 -04:00
|
|
|
class Text #:nodoc:
|
2012-06-15 11:17:21 -04:00
|
|
|
attr_accessor :type
|
2010-03-12 14:39:53 -05:00
|
|
|
|
2012-06-15 11:17:21 -04:00
|
|
|
def initialize(string, type = nil)
|
|
|
|
@string = string.to_s
|
2012-07-05 16:02:11 -04:00
|
|
|
@type = Types[type] || type if type
|
|
|
|
@type ||= Types[: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
|
|
|
|
|
2012-06-22 20:11:57 -04:00
|
|
|
def to_str
|
|
|
|
@string
|
|
|
|
end
|
|
|
|
|
2009-12-02 23:01:01 -05:00
|
|
|
def render(*args)
|
2012-06-22 20:11:57 -04:00
|
|
|
to_str
|
2009-12-02 23:01:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def formats
|
2014-02-18 14:12:51 -05:00
|
|
|
[@type.respond_to?(:ref) ? @type.ref : @type.to_s]
|
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
|