Class: Pdfrb::Model::Reference
- Inherits:
-
Object
- Object
- Pdfrb::Model::Reference
show all
- Includes:
- Comparable
- Defined in:
- lib/pdfrb/model/reference.rb
Overview
A pointer to an indirect object (s7.3.10). Value-equal by (oid, gen)
so it can be a Hash key. Stored inside dictionaries/arrays wherever
an indirect reference appears in source.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(oid, gen = 0) ⇒ Reference
13
14
15
16
17
|
# File 'lib/pdfrb/model/reference.rb', line 13
def initialize(oid, gen = 0)
@oid = oid.to_i
@gen = gen.to_i
freeze
end
|
Instance Attribute Details
Returns the value of attribute gen.
11
12
13
|
# File 'lib/pdfrb/model/reference.rb', line 11
def gen
@gen
end
|
Returns the value of attribute oid.
11
12
13
|
# File 'lib/pdfrb/model/reference.rb', line 11
def oid
@oid
end
|
Instance Method Details
#<=>(other) ⇒ Object
19
20
21
22
23
|
# File 'lib/pdfrb/model/reference.rb', line 19
def <=>(other)
return nil unless other.is_a?(Reference)
[oid, gen] <=> [other.oid, other.gen]
end
|
#deref(document) ⇒ Object
Resolve via the document's object reader. Returns an Object.
44
45
46
|
# File 'lib/pdfrb/model/reference.rb', line 44
def deref(document)
document.object(self)
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
29
30
31
|
# File 'lib/pdfrb/model/reference.rb', line 29
def eql?(other)
other.is_a?(Reference) && oid == other.oid && gen == other.gen
end
|
25
26
27
|
# File 'lib/pdfrb/model/reference.rb', line 25
def hash
[oid, gen].hash
end
|
39
40
41
|
# File 'lib/pdfrb/model/reference.rb', line 39
def inspect
"#<Pdfrb::Model::Reference oid=#{oid} gen=#{gen}>"
end
|
35
36
37
|
# File 'lib/pdfrb/model/reference.rb', line 35
def to_s
"#{oid} #{gen} R"
end
|