Building XML using the RexleBuilder gem

require 'rexle'
require 'rexle-builder'


a = RexleBuilder.build do |xml|
  xml.records(color: 'red' ) do
    xml.something do 
      xml.ref '1234'
    end
  end
end

puts Rexle.new(a).xml pretty: true

Output:

<?xml version='1.0' encoding='UTF-8'?>
<records color='red'>
  <something>
    <ref>1234</ref>
  </something>
</records>