Class: REXML::Document

Inherits:
Element
  • Object
show all
Defined in:
lib/httparty/core_extensions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#write(output = $stdout, indent = -1,, transitive = false, ie_hack = false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/httparty/core_extensions.rb', line 9

def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
  if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
    output = Output.new( output, xml_decl.encoding )
  end
  formatter = if indent > -1
      if transitive
        REXML::Formatters::Transitive.new( indent, ie_hack )
      else
        REXML::Formatters::Pretty.new( indent, ie_hack )
      end
    else
      REXML::Formatters::Default.new( ie_hack )
    end
  formatter.write( self, output )
end