diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-30 14:25:21 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-30 14:25:21 +0000 |
commit | 7eb52a8cd5ad6c40d86e6ea532114c9236a407a4 (patch) | |
tree | 259426500bdeb962341e87f9c73e5416a075cfb2 /lib/soap/generator.rb | |
parent | 1a4c78d7c108a189683903b6a2a9d1ddf1753933 (diff) | |
download | ruby-7eb52a8cd5ad6c40d86e6ea532114c9236a407a4.tar.gz |
* lib/soap/generator.rb: better XML pretty printing.
* lib/soap/encodingstyle/soapHandler.rb: remove unnecessary namespace
assignment in the element which has "encodingStyle" attribute, and add
necessary namespace assignment for "arrayType" attribute.
* test/soap/calc/test_calc_cgi.rb: take over $DEBUG to ruby process through CGI.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap/generator.rb')
-rw-r--r-- | lib/soap/generator.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/soap/generator.rb b/lib/soap/generator.rb index e0ac484c42..7ddb105f7d 100644 --- a/lib/soap/generator.rb +++ b/lib/soap/generator.rb @@ -145,14 +145,17 @@ public end def encode_tag(elename, attrs = nil) - if attrs - @buf << "\n#{ @indent }<#{ elename }" << - attrs.collect { |key, value| - %Q[ #{ key }="#{ value }"] - }.join << - '>' - else + if !attrs or attrs.empty? @buf << "\n#{ @indent }<#{ elename }>" + elsif attrs.size == 1 + key, value = attrs.shift + @buf << %Q[\n#{ @indent }<#{ elename } #{ key }="#{ value }">] + else + @buf << "\n#{ @indent }<#{ elename } " << + attrs.collect { |key, value| + %Q[#{ key }="#{ value }"] + }.join("\n#{ @indent } ") << + '>' end end |