Passing options to encode method
Vin0uz opened this issue · 1 comments
I recently faced a little issue using this gem, when handling a transformation of hash/array into xml.
{items: [ { item: { foo: "bar" } }, { item: { foo: "bar2" } } ]
would be parsed into
<items><item>...</item></items><items><item>...</item></items>
Instead of
<items><item>...</item><item>...</item></items>
Exploring a bit the how and the why, we can solve this kind of issue by giving parameters to Gyoku.
Instead of explicitly name all possible options, and to match Gyoku's style (Note that options are passed as a second Hash to the .xml method.
), we could provide options parameter in encode
and forward it to Gyoku.
It would build a quite strong link between this gem and Gyoku though (if willing to switch parser later, then the behaviour must be adapted etc.) but it would make the usage of this gem easier for specific cases.
I can make the diff if you are ok with this idea :)