Class: Riddl::Utils::XSLOverlay

Inherits:
Implementation show all
Defined in:
lib/ruby/riddl/utils/xsloverlay.rb

Instance Method Summary collapse

Methods inherited from Implementation

#headers, #initialize, #status

Constructor Details

This class inherits a constructor from Riddl::Implementation

Instance Method Details

#responseObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby/riddl/utils/xsloverlay.rb', line 5

def response
  doc = if @p[0].value.class == String 
    XML::Smart::string(@p[0].value)
  elsif @p[0].value.respond_to?(:read)
    XML::Smart::string(@p[0].value.read)
  else
    nil
  end
  unless doc.nil?
    doc.root.add_before "?xml-stylesheet", "href='#{@a[0]}' type='text/xsl'"
    Riddl::Parameter::Complex.new("content",@p[0].mimetype,doc.to_s)
  end  
end