Class: Canon::PrettyPrinter::Xml
- Inherits:
-
Object
- Object
- Canon::PrettyPrinter::Xml
- Defined in:
- lib/canon/pretty_printer/xml.rb
Instance Method Summary collapse
- #format(xml_string) ⇒ Object
-
#initialize(indent: 2, indent_type: "space") ⇒ Xml
constructor
A new instance of Xml.
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 |