Class: Canon::PrettyPrinter::Xml

Inherits:
Object
  • Object
show all
Defined in:
lib/canon/pretty_printer/xml.rb

Instance Method Summary collapse

Constructor Details

#initialize(indent: 2, indent_type: "space") ⇒ Xml

Returns a new instance of Xml.



8
9
10
11
# File 'lib/canon/pretty_printer/xml.rb', line 8

def initialize(indent: 2, indent_type: "space")
  @indent = indent.to_i
  @indent_type = indent_type
end

Instance Method Details

#format(xml_string) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/canon/pretty_printer/xml.rb', line 13

def format(xml_string)
  if Canon::XmlBackend.nokogiri?
    nokogiri_format(xml_string)
  else
    moxml_format(xml_string)
  end
end