class WorldpayCnp::XML::Nokogiri::Parser

Public Instance Methods

call(xml) click to toggle source
Calls superclass method WorldpayCnp::XML::Parser#call
# File lib/worldpay_cnp/xml/nokogiri.rb, line 7
def call(xml)
  super(xml)
rescue ::Nokogiri::XML::SyntaxError => error
  raise Error::XmlParseError, error.message, error.backtrace
end

Private Instance Methods

root(xml) click to toggle source
# File lib/worldpay_cnp/xml/nokogiri.rb, line 15
def root(xml)
  ::Nokogiri::XML(xml) { |c| c.options = ::Nokogiri::XML::ParseOptions::NOBLANKS }.root
end
value_with!(element) click to toggle source
# File lib/worldpay_cnp/xml/nokogiri.rb, line 19
def value_with!(element)
  return element.text if element.attributes.empty? && element.elements.empty?
  element.to_h.merge(hash_with(*element.elements))
end