I\'m currently using the Nokogiri::XML::Builder class to construct an XML document, then calling .to_xml on it. The resulting string always contains a bunch of spaces, line
b.to_xml returns a string. You just need to replace the first instance of \n in the string.
b.to_xml
\n
require 'nokogiri' b = Nokogiri::XML::Builder.new do |xml| xml.root do xml.text("Value") end end b.to_xml.sub("\n",'')
Probably easier than trying to overload the method.