qbwc / qbxml

QBXML Parser and Validation Tool
MIT License
27 stars 41 forks source link

Arrays of strings are not translated #11

Closed JasonBarnabe closed 9 years ago

JasonBarnabe commented 9 years ago
2.1.3 :001 > require 'qbxml'
 => false 
2.1.3 :002 > Qbxml::Hash.to_xml({:foo => {:bar => 'baz'}})
 => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n  <bar>baz</bar>\n</foo>\n" 
2.1.3 :003 > Qbxml::Hash.to_xml({:foo => {:bar => ['baz']}})
ArgumentError: XmlMarkup cannot mix a text argument with a block
    from /home/jason/.rvm/gems/ruby-2.1.3/gems/builder-3.1.4/lib/builder/xmlbase.rb:56:in `tag!'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:58:in `hash_to_xml'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:64:in `block (3 levels) in hash_to_xml'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:64:in `map'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:64:in `block (2 levels) in hash_to_xml'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:59:in `each'
    from /home/jason/.rvm/gems/ruby-2.1.3/bundler/gems/qbxml-7d4e345224cb/lib/qbxml/hash.rb:59:in `block in hash_to_xml'

An actual use of this would be providing a number of IncludeRetElements.