Flowdock
add_attribute( key, value=nil ) public

Adds an attribute to this element, overwriting any existing attribute by the same name.

key:can be either an Attribute or a String. If an Attribute, the attribute is added to the list of Element attributes. If <a href="/ruby/String">String,</a> the argument is used as the name of the new attribute, and the value parameter must be supplied.
value:Required if key is a String, and ignored if the first argument is an Attribute. This is a String, and is used as the value of the new Attribute. This should be the unnormalized value of the attribute (without entities).
Returns:the Attribute added
 e = Element.new 'e'
 e.add_attribute( 'a', 'b' )               #-> <e a='b'/>
 e.add_attribute( 'x:a', 'c' )             #-> <e a='b' x:a='c'/>
 e.add_attribute Attribute.new('b', 'd')   #-> <e a='b' x:a='c' b='d'/>
Show source
Register or log in to add new notes.