add(element=nil)
public
Adds an element
element |
if supplied, is either an Element, String, or Source
(see Element.initialize). If not supplied or nil, a new, default Element will be constructed
|
Returns |
the added Element
|
a = Element.new(‘a’) a.elements.add(Element.new(‘b’)) #->
<a> a.elements.add(‘c’) #->
<a><c/>
Show source
def add element=nil
rv = nil
if element.nil?
Element.new("", self, @element.context)
elsif not element.kind_of?(Element)
Element.new(element, self, @element.context)
else
@element << element
element.context = @element.context
element
end
end