class REXML::Attributes
def []=( name, value )
attrs.include?('baz:att') # => false
attrs['baz:att'] = nil
When +value+ is +nil+, deletes the attribute if it exists:
attrs['baz:att'] = '3' # => "3"
attrs['foo:att'] = '2' # => "2"
attrs = ele.attributes
ele = d.root.elements['//ele'] # =>
d = REXML::Document.new(xml_string)
EOT
xml_string = <<-EOT
overwriting the previous value if it exists:
assigns that to the attribute for the given +name+,
When +value+ is non-+nil+,
[name] = value -> value
:call-seq:
def []=( name, value ) if value.nil? # Delete the named attribute attr = get_attribute(name) delete attr return end unless value.kind_of? Attribute if @element.document and @element.document.doctype value = Text::normalize( value, @element.document.doctype ) else value = Text::normalize( value, nil ) end value = Attribute.new(name, value) end value.element = @element old_attr = fetch(value.name, nil) if old_attr.nil? store(value.name, value) elsif old_attr.kind_of? Hash old_attr[value.prefix] = value elsif old_attr.prefix != value.prefix store value.name, {old_attr.prefix => old_attr, value.prefix => value} else store value.name, value end return @element end