class HexaPDF:: PDFArray
| Parent | HexaPDF::Object |
|---|---|
| Included Modules |
Enumerable |
Implementation of the PDF array type.
This is mainly done to provide automatic resolution of indirect object references when using the [] method. Therefore not all Array methods are implemented - use the value directly if other methods are needed.
See: PDF2.0 s7.3.6
Public Instance Methods
Append a value to the array.
Returns the value at the given index, or a subarray using the given start and length, or a subarray specified by range.
This method should be used instead of direct access to a value because it provides some advantages:
-
References are automatically resolved.
-
Returns the native Ruby object for values with class
HexaPDF::Object. However, all subclasses ofHexaPDF::Objectare returned as is (it makes no sense, for example, to return the hash that describes the Catalog instead of the Catalog object).
Note: Hash or Array values will always be returned as-is, i.e. not wrapped with Dictionary or PDFArray.
Stores the data under the given index in the array.
If the current value for this index has the class HexaPDF::Object (and only this, no subclasses) and the given data has not (including subclasses), the data is stored inside the HexaPDF::Object.
Removes all nil elements from the array. Returns self if any elements were removed, nil otherwise.
Deletes all values from the PDFArray that are equal to the given object.
Returns the last deleted item, or nil if no matching item is found.
Deletes the value at the given index.
Calls the given block once for every value of the array.
Note that the yielded value is already preprocessed like in [].
Returns true if the array has no elements.
Returns the index of the first object such that object is == to obj, or, if a block is given, the index of the first object for which the block returns true.
Insert one or more values into the array at the given index.
Maps all elements from the array in-place to the respective return value of the block+ and returns self.
Deletes all elements from the array for which the block returns true and returns self. If no changes were done, returns nil.