lib/lolsoap/builder.rb in lolsoap-0.1.4 vs lib/lolsoap/builder.rb in lolsoap-0.2.0
- old
+ new
@@ -53,10 +53,14 @@
# add tags for the very small number of tags that are also existing methods.
def __tag__(name, *args, &block)
__prefixed_tag__(@type.prefix, @type.sub_type(name.to_s), name, *args, &block)
end
+ def __attribute__(name, value)
+ @node[name.to_s] = value.to_s
+ end
+
# @private
def __prefixed_tag__(prefix, sub_type, name, *args)
sub_node = @node.document.create_element(name.to_s, *args)
sub_node.namespace = @node.namespace_scopes.find { |n| n.prefix == prefix }
@@ -86,8 +90,15 @@
true
end
private
- alias method_missing __tag__
+ # alias method_missing __tag__
+ def method_missing(name, *args, &block)
+ if @type.has_attribute?(name.to_s)
+ __attribute__(name, *args)
+ else
+ __tag__(name, *args, &block)
+ end
+ end
end
end