aboutsummaryrefslogblamecommitdiffstats
path: root/actionview/lib/action_view/template/handlers/builder.rb
blob: 67ad78133d2811cd4127670f34339ca299b3215d (plain) (tree)
1
2
3
4
5
6
7
8
9
                 
                           
                 
                                                    
 
                        
                      
                                                         
                                               
                           
                         
         
 
             
                                  



                             
           


       
module ActionView
  module Template::Handlers
    class Builder
      class_attribute :default_format, default: :xml

      def call(template)
        require_engine
        "xml = ::Builder::XmlMarkup.new(:indent => 2);" \
          "self.output_buffer = xml.target!;" +
          template.source +
          ";xml.target!;"
      end

      private
        def require_engine # :doc:
          @required ||= begin
            require "builder"
            true
          end
        end
    end
  end
end