class HexaPDF::Reference

Parent
Included Modules

A reference to an indirect object.

The PDF syntax allows for references to existing and non-existing indirect objects. Such references are represented with objects of this class.

Note that after initialization changing the object or generation numbers is not possible anymore!

The methods hash and eql? are implemented so that objects of this class can be used as hash keys. Furthermore the implementation is compatible to the one of Object, i.e. the hash of a Reference object is the same as the hash of an indirect Object.

See: PDF2.0 s7.3.10, Object

Attributes

gen[R]

Returns the generation number of the referenced indirect object.

oid[R]

Returns the object number of the referenced indirect object.

Public Class Methods

new(oid, gen = 0)

Creates a new Reference with the given object number and, optionally, generation number.

Public Instance Methods

<=>(other)

Compares this object to another object.

If the other object does not respond to oid or gen, nil is returned. Otherwise objects are ordered first by object number and then by generation number.

==(other)
Alias for: eql?
eql?(other)

Returns true if the other object references the same PDF object as this reference object.

This is necessary so that Object and Reference objects can be used as interchangable hash keys and can be compared.

Also aliased as: ==
hash()

Computes the hash value based on the object and generation numbers.

to_s()

Returns the object identifier as “oid,gen”.