Skip to content

Instantly share code, notes, and snippets.

@maxenglander
maxenglander / tidy_helper.rb
Created December 6, 2011 15:44
Tidy XML with Ruby
module TidyHelper
def self.tidy_xml xml_string
IO.popen("tidy -q --input-xml y --output-xml y --indent 'auto' --indent-attributes y --indent-spaces '4' --wrap '90'", "w+") do |pipe|
buffer = String.new