aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_view/template/text.rb
blob: 5978a8a3ac94b1868f7535f6190229464b94bd9c (plain) (tree)
1
2
3
4
5
6
7
                          

                                
                                                
                          

                                                                            






                                            
                       




















                       
       

     
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 details
        {:formats => [@content_type.to_sym]}
      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
        [mime_type]
      end

      def partial?
        false
      end
    end
  end
end