168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'lib/soap/generator.rb', line 168
def encode_tag(elename, attrs = nil)
if attrs.nil? or attrs.empty?
@buf << "\n#{ @indent }<#{ elename }>"
return
end
ary = []
attrs.each do |key, value|
ary << %Q[#{ key }="#{ value }"] unless value.nil?
end
case ary.size
when 0
@buf << "\n#{ @indent }<#{ elename }>"
when 1
@buf << %Q[\n#{ @indent }<#{ elename } #{ ary[0] }>]
else
@buf << "\n#{ @indent }<#{ elename } " <<
ary.join("\n#{ @indent }#{ @indentstr * 2 }") <<
'>'
end
end
|