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

                                


                                             
                          

                                                                

         
                    
                       









                       
                 
                                                                         
         
       

     
module ActionView #:nodoc:
  # = Action View Text Template
  class Template
    class Text < String #:nodoc:
      attr_accessor :mime_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
      end

      def identifier
        'text template'
      end

      def inspect
        'text template'
      end

      def render(*args)
        to_s
      end

      def formats
        [@mime_type.respond_to?(:ref) ? @mime_type.ref : @mime_type.to_s]
      end
    end
  end
end