class REXML::Attributes
def delete( attribute )
attrs.delete(attr) # =>
attrs.delete(attr) # =>
attr = REXML::Attribute.new('bar:att', '2')
removes that attribute if it exists:
When attribute argument +attribute+ is given,
attrs.delete('foo:att') # =>
attrs.delete('foo:att') # =>
attrs = ele.attributes
ele = d.root.elements['//ele'] # =>
d = REXML::Document.new(xml_string)
EOT
xml_string = <<-EOT
removes the attribute of that name if it exists:
When string argument +name+ is given,
returns the attributes' element.
Removes a specified attribute if it exists;
delete(attribute) -> element
delete(name) -> element
:call-seq:
def delete( attribute ) name = nil prefix = nil if attribute.kind_of? Attribute name = attribute.name prefix = attribute.prefix else attribute =~ Namespace::NAMESPLIT prefix, name = $1, $2 prefix = '' unless prefix end old = fetch(name, nil) if old.kind_of? Hash # the supplied attribute is one of many old.delete(prefix) if old.size == 1 repl = nil old.each_value{|v| repl = v} store name, repl end elsif old.nil? return @element else # the supplied attribute is a top-level one super(name) end @element end