Class

Elements

Extends:

Includes:

A class which provides filtering of children for Elements, and XPath search support. You are expected to only encounter this class as the element.elements object. Therefore, you are not expected to instantiate this yourself.

Public Methods
<< Alias for #add
[] Fetches a child element. Filters only Element children, regardless of the XPath match.
[]= Sets an element, replacing any previous matching element. If no existing element is found ,the element is added.
add Adds an element
collect
delete Deletes a child Element
delete_all Removes multiple elements. Filters for Element children, regardless of XPath matching.
each Iterates through all of the child Elements, optionally filtering them by a given XPath
empty? Returns true if there are no Element children, false otherwise
index Returns the index of the supplied child (starting at 1), or -1 if the element is not a child
inject
new Constructor
size Returns the number of Element children of the parent object.
to_a Returns an Array of Element children. An XPath may be supplied to filter the children. Only Element children are returned, even if the supplied XPath matches non-Element children.
Private Methods
literalize Private helper class. Removes quotes from quoted strings
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.