class WorldpayCnp::XML::Nokogiri::Serializer
Public Instance Methods
call(hash)
click to toggle source
# File lib/worldpay_cnp/xml/nokogiri.rb, line 28 def call(hash) ::Nokogiri::XML::Document.new.tap { |d| add_xml_elements!(d, hash) }.to_s end
Private Instance Methods
attributes_or_elements!(parent, key, value)
click to toggle source
# File lib/worldpay_cnp/xml/nokogiri.rb, line 34 def attributes_or_elements!(parent, key, value) return parent[attribute_name(key)] = text_with(value) if attribute?(key) element = ::Nokogiri::XML::Element.new(key.to_s, parent) parent.add_child(element) add_xml_elements!(element, value) end
insert_text!(element, text)
click to toggle source
# File lib/worldpay_cnp/xml/nokogiri.rb, line 41 def insert_text!(element, text) element.add_child(text_with(text)) end