aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/text.rb
blob: df394b0fb023221a9f37b1a11b0a5eb71c37b9e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module ActionView #:nodoc:
  class Template
    class Text < String #:nodoc:
      def initialize(string, content_type = nil)
        super(string.to_s)
        @content_type   = Mime[content_type] || content_type if content_type
        @content_type ||= Mime::TEXT
      end

      def identifier
        'text template'
      end

      def inspect
        'text template'
      end

      def render(*args)
        to_s
      end

      def mime_type
        @content_type
      end

      def formats
        [@content_type.to_sym]
      end

      def partial?
        false
      end
    end
  end
end