Replaces this object with another object. Basically, calls Parent.replace_child
self
Sets the previous sibling of this child. This can be used to insert a child before some other child.
a = Element.new("a") b = a.add_element("b") c = Element.new("c") b.previous_sibling = c # => <a><b/><c/></a>
Adds a child to this element, optionally setting attributes in the element.
optional. If Element
, the element is added. Otherwise, a new Element
is constructed with the argument (see Element.initialize).
If supplied, must be a Hash
containing String
name,value pairs, which will be used to set the attributes of the new Element
.
the Element
that was added
el = doc.add_element 'my-tag' el = doc.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'} el = Element.new 'my-tag' doc.add_element el
Deletes a child element.
Must be an Element
, String
, or Integer
. If Element
, the element is removed. If String
, the element is found (via XPath
) and removed. <em>This means that any parent can remove any descendant.<em> If Integer
, the Element
indexed by that number will be removed.
the element that was removed.
doc.delete_element "/a/b/c[@id='4']" doc.delete_element doc.elements["//k"] doc.delete_element 1
Evaluates to true
if this element has at least one child Element
doc = Document.new "<a><b/><c>Text</c></a>" doc.root.has_elements # -> true doc.elements["/a/b"].has_elements # -> false doc.elements["/a/c"].has_elements # -> false
Synonym for Element.elements
.each
Synonym for Element.to_a This is a little slower than calling elements.each directly.
Returns the next sibling that is an element, or nil if there is no Element
sibling after this one
doc = Document.new '<a><b/>text<c/></a>' doc.root.elements['b'].next_element #-> <c/> doc.root.elements['c'].next_element #-> nil
Replaces one child with another, making sure the nodelist is correct @param to_replace the child to replace (must be a Child
) @param replacement the child to insert into the nodelist (must be a Child
)
Generates a Source
object @param arg Either a String
, or an IO
@return a Source
, or nil if a bad argument was given
@return the current line in the source
@return the current line in the source
Reads all tuples matching tuple
from the proxied TupleSpace
. See TupleSpace#read_all
.
Creates a thread that notifies waiting clients from the TupleSpace
.
Pulls lookup tuples out of the TupleSpace
and sends their DRb
object the address of the local TupleSpace
.
Returns an expiry Time
based on sec
which can be one of:
Returns a valid argument to make_expires
and the renewer or nil.
Given true
, nil
, or Numeric
, returns that value and nil
(no actual renewer). Otherwise it returns an expiry value from calling it.renew
and the renewer.
true
if the TupleBag
to see if it has any expired entries.
Returns all tuples matching tuple
. Does not remove the found tuples.
Notifies all registered listeners for event
of a status change of tuple
.