class PDF::Reader::Reference

An internal PDF::Reader class that represents an indirect reference to a PDF Object

Attributes

gen[R]
id[R]

Public Class Methods

new(id, gen) click to toggle source

Create a new Reference to an object with the specified id and revision number

# File lib/pdf/reader/reference.rb, line 35
def initialize(id, gen)
  @id, @gen = id, gen
end

Public Instance Methods

==(obj) click to toggle source

returns true if the provided object points to the same PDF Object as the current object

# File lib/pdf/reader/reference.rb, line 51
def ==(obj)
  return false unless obj.kind_of?(PDF::Reader::Reference)

  self.hash == obj.hash
end
Also aliased as: eql?
eql?(obj)
Alias for: ==
hash() click to toggle source

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

# File lib/pdf/reader/reference.rb, line 61
def hash
  "#{self.id}:#{self.gen}".hash
end
to_a() click to toggle source

returns the current Reference object in an array with a single element

# File lib/pdf/reader/reference.rb, line 40
def to_a
  [self]
end
to_i() click to toggle source

returns the ID of this reference. Use with caution, ignores the generation id

# File lib/pdf/reader/reference.rb, line 45
def to_i
  self.id
end