class REXML::Element
def add_attribute( key, value=nil )
e['attr'] # => "VALUE"
e.add_attribute(a) # => attr='VALUE'
a = REXML::Attribute.new('attr', 'VALUE')
e['attr'] # => "value"
e.add_attribute(a) # => attr='value'
a = REXML::Attribute.new('attr', 'value')
adds the given attribute:
With only attribute object +attribute+ given,
e['attr'] # => "VALUE"
e.add_attribute('attr', 'VALUE') # => "VALUE"
e['attr'] # => "value"
e.add_attribute('attr', 'value') # => "value"
e = REXML::Element.new
adds the attribute created with that name and value:
With string argument +name+ and object +value+ are given,
by the same name.
Adds an attribute to this element, overwriting any existing attribute
add_attribute(attribute) -> attribute
add_attribute(name, value) -> value
:call-seq:
def add_attribute( key, value=nil ) if key.kind_of? Attribute @attributes << key else @attributes[key] = value end end