class Paramedic::XMLMasseuse
Attributes
xml[R]
Public Class Methods
new(xml, opts={})
click to toggle source
# File lib/paramedic/xml_masseuse.rb, line 6 def initialize(xml, opts={}) @xml = xml @escape_tags = opts.fetch(:escape_tags, []) end
Public Instance Methods
to_xml()
click to toggle source
# File lib/paramedic/xml_masseuse.rb, line 11 def to_xml strip_tag_spacing( escape_specified_tags( Nokogiri::XML(remove_naked_ampersands(xml), &:noblanks) ) ) end
Private Instance Methods
remove_naked_ampersands(text)
click to toggle source
# File lib/paramedic/xml_masseuse.rb, line 21 def remove_naked_ampersands(text) text.gsub('&', '&') end
strip_tag_spacing(xml_document)
click to toggle source
# File lib/paramedic/xml_masseuse.rb, line 36 def strip_tag_spacing(xml_document) xml_document.to_xml( save_with: Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS ) end