Class: PDF::Reader::Reference
- Inherits:
-
Object
- Object
- PDF::Reader::Reference
- Defined in:
- lib/pdf/reader/reference.rb
Overview
An internal PDF::Reader class that represents an indirect reference to a PDF Object
Instance Attribute Summary (collapse)
-
- (Object) gen
readonly
Returns the value of attribute gen.
-
- (Object) id
readonly
Returns the value of attribute id.
Instance Method Summary (collapse)
-
- (Object) ==(obj)
(also: #eql?)
returns true if the provided object points to the same PDF Object as the current object.
-
- (Object) hash
returns a hash based on the PDF::Reference this object points to.
-
- (Reference) initialize(id, gen)
constructor
Create a new Reference to an object with the specified id and revision number.
-
- (Object) to_a
returns the current Reference object in an array with a single element.
-
- (Object) to_i
returns the ID of this reference.
Constructor Details
- (Reference) initialize(id, gen)
Create a new Reference to an object with the specified id and revision number
33 34 35 |
# File 'lib/pdf/reader/reference.rb', line 33 def initialize (id, gen) @id, @gen = id, gen end |
Instance Attribute Details
- (Object) gen (readonly)
Returns the value of attribute gen
30 31 32 |
# File 'lib/pdf/reader/reference.rb', line 30 def gen @gen end |
- (Object) id (readonly)
Returns the value of attribute id
30 31 32 |
# File 'lib/pdf/reader/reference.rb', line 30 def id @id end |
Instance Method Details
- (Object) ==(obj) Also known as: eql?
returns true if the provided object points to the same PDF Object as the current object
49 50 51 52 53 |
# File 'lib/pdf/reader/reference.rb', line 49 def ==(obj) return false unless obj.kind_of?(PDF::Reader::Reference) self.hash == obj.hash end |
- (Object) hash
returns a hash based on the PDF::Reference this object points to. Two different Reference objects that point to the same PDF Object will return an identical hash
59 60 61 |
# File 'lib/pdf/reader/reference.rb', line 59 def hash "#{self.id}:#{self.gen}".hash end |
- (Object) to_a
returns the current Reference object in an array with a single element
38 39 40 |
# File 'lib/pdf/reader/reference.rb', line 38 def to_a [self] end |
- (Object) to_i
returns the ID of this reference. Use with caution, ignores the generation id
43 44 45 |
# File 'lib/pdf/reader/reference.rb', line 43 def to_i self.id end |