I have a function like so:
def add_auth_fields
xml = Builder::XmlMarkup.new(:target => '')
xml.instruct! :xml
xml.inquiry do |inquiry|
inquiry.authentication do |auth|
auth.username USERNAME
auth.password PASSWORD
end
end
xml
end
How can I access the xml.inquiry
node at a later time to add more data inside of that node?
If I call xml.inquiry do |inquiry|
again, it just adds another node to my xml.
Here is another example where I want to change the value of foo, but instead, it is adding another foo node to the xml.
[195] pry(main)> xml_markup = Builder::XmlMarkup.new
=> <pretty_inspect/>
[196] pry(main)> xml_markup.foo 'bar'
=> "<pretty_inspect/><foo>bar</foo>"
[197] pry(main)> xml_markup.foo 'test'
=> "<pretty_inspect/><foo>bar</foo><foo>test</foo>"