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

                             
                 
                           
                 
                                                    
 
                                
                      
                                                         
                                               
                  
                         
         
 
             
                                  



                             
           


       
# frozen_string_literal: true

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

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

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