Sha256: 5c52b3e8afad1bfc249cb3af58d5c3012fb3f184d336f69d7acea5d98bf5c445

Contents?: true

Size: 803 Bytes

Versions: 5

Compression:

Stored size: 803 Bytes

Contents

module Merb
  
  module Template
    
    module XMLBuilder
    
      ::Merb::Controller.register_engine self, %w[ rxml xerb builder]
    
      class << self

        def exempt_from_layout?
          true    
        end
        
        def transform(options = {})
          opts, file, view_context = options.values_at(:opts, :file, :view_context)
          xml_body = IO.read(file) 
          view_context.headers['Content-Type'] = 'application/xml'
          view_context.headers['Encoding']     = 'UTF-8'
          view_context.instance_eval %{
            xml = Builder::XmlMarkup.new :indent => 2
            xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
            #{xml_body}
            return xml.target!
          }
        end

      end
      
    end
        
  end
    
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb-0.3.4 lib/merb/template/xml_builder.rb
merb-0.2.0 lib/merb/template/xml_builder.rb
merb-0.3.0 lib/merb/template/xml_builder.rb
merb-0.3.1 lib/merb/template/xml_builder.rb
merb-0.3.3 lib/merb/template/xml_builder.rb