class Parent
Extends Child
Includes Enumerable
A parent has children, and has methods for accessing them. The Parent class is never encountered except as the superclass for some other object.
Methods
Aliases
push
is a synonym for
add
<<
is a synonym for
push
each_child
is a synonym for
each
Methods
[]
Arguments
index
the Integer index of the child to fetch
Fetches a child at a given index
[]=
Arguments
Returns
the parent (self)
Set an index entry. See Array.[]= @return the parent (self)
index
Arguments
child
the child to get the index of
Returns
the index of the child, or nil if the object is not a child of this parent.
Fetches the index of a given child
initialize
Arguments
parent<nil>
if supplied, will be set as the parent of this object
Constructor
insert_after
Arguments
child1
the child to insert after
child2
the child to insert
Returns
the parent (self)
Inserts an child after another child @return the parent (self)
insert_before
Arguments
child1
the child to insert before
child2
the child to insert
Returns
the parent (self)
Inserts an child before another child @return the parent (self)
replace_child
Arguments
to_replace
the child to replace (must be a Child)
replacement
the child to insert into the nodelist (must be a Child)
Replaces one child with another, making sure the nodelist is correct
size
Returns
the number of children of this parent