Module: Lipa::Web::Response::XML

Extended by:
Helpers::Response
Defined in:
lib/lipa/web/response/xml.rb

Class Method Summary collapse

Methods included from Helpers::Response

read_template

Class Method Details

.response(node) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/lipa/web/response/xml.rb', line 34

def self.response(node)
  xml = Builder::XmlMarkup.new        
  if node.xml
    if node.xml[:block]
      node.xml[:block].call(xml)
    else
      case node.xml[:render]
      when :builder
        template = read_template(node.xml[:template])
      end
      eval(template, context(node,xml))
    end
  else
    eval(default_template, context(node,xml))
  end

  [200, {"Content-Type" => "application/xml"}, [ xml.target!]]
end