lib/builder/xmlbase.rb in builder-1.2.4 vs lib/builder/xmlbase.rb in builder-2.0.0

- old
+ new

@@ -11,11 +11,11 @@ # Builder::XmlMarkup and Builder::XmlEvents for examples. class XmlBase < BlankSlate # Create an XML markup builder. # - # out:: Object receiving the markup.1 +out+ must respond to + # out:: Object receiving the markup. +out+ must respond to # <tt><<</tt>. # indent:: Number of spaces used for indentation (0 implies no # indentation and no line breaks). # initial:: Level of initial indentation. # @@ -109,14 +109,16 @@ false end private + require 'builder/xchar' def _escape(text) - text. - gsub(%r{&}, '&amp;'). - gsub(%r{<}, '&lt;'). - gsub(%r{>}, '&gt;') + text.to_xs + end + + def _escape_quote(text) + _escape(text).gsub(%r{"}, '&quot;') # " WART end def _capture_outer_self(block) @self = eval("self", block) end