This PR adds :pretty_print, :indent and :compact options to allow prettified XML output.
There is an old PR https://github.com/savonrb/gyoku/pull/35 that has the same purpose, but it stumbled over problems in Builder gem. In this PR I don't mess with Builder gem but instead use REXML from standard Ruby library to format generated XML.
Prettifying doesn't work for XML documents generated from an array without unwrap option set to true as such documents are not valid and cannot be formatted by REXML. This case is just bypassed, no exceptions thrown.
This PR adds
:pretty_print
,:indent
and:compact
options to allow prettified XML output. There is an old PR https://github.com/savonrb/gyoku/pull/35 that has the same purpose, but it stumbled over problems in Builder gem. In this PR I don't mess with Builder gem but instead useREXML
from standard Ruby library to format generated XML. Prettifying doesn't work for XML documents generated from an array withoutunwrap
option set totrue
as such documents are not valid and cannot be formatted byREXML
. This case is just bypassed, no exceptions thrown.