Class

A Child object is something contained by a parent, and this class contains methods to support that. Most user code will not use this class directly.

Attributes
Read
No documentation available
Class Methods

Constructor. Any inheritors of this class should call super to make sure this method is called.

parent

if supplied, the parent of this child will be set to the supplied value, and self will be added to the parent

Instance Methods

This doesn’t yet handle encodings

Returns

the document this child belongs to, or nil if this child

belongs to no document

Sets the next sibling of this child. This can be used to insert a child after some other child.

a = Element.new("a")
b = a.add_element("b")
c = Element.new("c")
b.next_sibling = c
# => <a><b/><c/></a>

Sets the parent of this child to the supplied argument.

other

Must be a Parent object. If this object is the same object as the existing parent of this child, no action is taken. Otherwise, this child is removed from the current parent (if one exists), and is added to the new parent.

Returns

The parent added

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>

Removes this child from the parent.

Returns

self

Replaces this object with another object. Basically, calls Parent.replace_child

Returns

self