Class RTF::ColourTable
In: lib/rtf/colour.rb
Parent: Object

This class represents a table of colours used within a RTF document. This class need not be directly instantiated as it will be used internally by, and can be obtained from a Document object.

Methods

<<   []   add   each   index   new   size   to_rtf   to_s  

Public Class methods

This is the constructor for the ColourTable class.

Parameters

*colours:An array of zero or more colours that make up the colour table entries.

Public Instance methods

<<(colour)

Alias for add

This method overloads the array dereference operator for the ColourTable class. It is not possible to dereference the implicit default colour using this method. An invalid index will return a nil value.

Parameters

index:The index of the colour to be retrieved.

This method adds a new colour to a ColourTable object. If the colour already exists within the table or is not a Colour object then this method does nothing.

Parameters

colour:The colour to be added to the table.

This method iterates over the contents of a ColourTable object. This iteration does not include the implicit default colour entry.

This method retrieves the index of a specified colour within the table. If the colour doesn’t exist within the table then nil is returned. It should be noted that the index of a colour will be one more than its order of entry to account for the implicit default colour entry.

Parameters

colour:The colour to retrieve the index of.

This method fetches a count of the number of colours within a colour table.

This method generates the RTF text for a ColourTable object.

Parameters

indent:The number of spaces to prefix to the lines generated by the method. Defaults to zero.

This method generates a textual description for a ColourTable object.

Parameters

indent:The number of spaces to prefix to the lines generated by the method. Defaults to zero.

[Validate]