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
-
#gen ⇒ Object
readonly
: Integer.
-
#id ⇒ Object
readonly
: Integer.
Instance Method Summary collapse
-
#==(obj) ⇒ Object
(also: #eql?)
returns true if the provided object points to the same PDF Object as the current object : (Object) -> bool.
-
#hash ⇒ Object
returns a hash based on the PDF::Reference this object points to.
-
#initialize(id, gen) ⇒ Reference
constructor
Create a new Reference to an object with the specified id and revision number : (Integer, Integer) -> void.
-
#to_a ⇒ Object
returns the current Reference object in an array with a single element : () -> Array.
-
#to_i ⇒ Object
returns the ID of this reference.
Constructor Details
#initialize(id, gen) ⇒ Reference
Create a new Reference to an object with the specified id and revision number : (Integer, Integer) -> void
42 43 44 45 |
# File 'lib/pdf/reader/reference.rb', line 42 def initialize(id, gen) @id = id @gen = gen end |
Instance Attribute Details
#gen ⇒ Object (readonly)
: Integer
38 39 40 |
# File 'lib/pdf/reader/reference.rb', line 38 def gen @gen end |
#id ⇒ Object (readonly)
: Integer
35 36 37 |
# File 'lib/pdf/reader/reference.rb', line 35 def id @id end |
Instance Method Details
#==(obj) ⇒ Object Also known as: eql?
returns true if the provided object points to the same PDF Object as the current object : (Object) -> bool
62 63 64 65 66 |
# File 'lib/pdf/reader/reference.rb', line 62 def ==(obj) return false unless obj.kind_of?(PDF::Reader::Reference) self.hash == obj.hash end |
#hash ⇒ Object
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 : () -> Integer
73 74 75 |
# File 'lib/pdf/reader/reference.rb', line 73 def hash "#{self.id}:#{self.gen}".hash end |
#to_a ⇒ Object
returns the current Reference object in an array with a single element : () -> Array
49 50 51 |
# File 'lib/pdf/reader/reference.rb', line 49 def to_a [self] end |
#to_i ⇒ Object
returns the ID of this reference. Use with caution, ignores the generation id : () -> Integer
55 56 57 |
# File 'lib/pdf/reader/reference.rb', line 55 def to_i self.id end |