Class Origami::Reference
In: sources/parser/reference.rb
sources/parser/obfuscation.rb
Parent: Object

Class representing a Reference Object. Reference are like symbolic links pointing to a particular object into the file.

Methods

<=>   eql?   new   real_type   solve   to_a   to_obfuscated_str   value  

Included Modules

Origami::Object

Attributes

refgen  [RW] 
refno  [RW] 

Public Class methods

[Source]

    # File sources/parser/reference.rb, line 41
41:     def initialize(refno, refgen)
42:       @refno, @refgen = refno, refgen
43:     end

Public Instance methods

[Source]

    # File sources/parser/reference.rb, line 82
82:     def <=>(ref) #:nodoc
83:       self.to_a <=> ref.to_a
84:     end

[Source]

    # File sources/parser/reference.rb, line 74
74:     def eql?(ref) #:nodoc
75:       ref.refno == @refno and ref.refgen == @refgen
76:     end

[Source]

     # File sources/parser/reference.rb, line 104
104:     def real_type ; Reference end

[Source]

    # File sources/parser/reference.rb, line 57
57:     def solve
58:       
59:       pdfdoc = self.pdf
60: 
61:       if pdfdoc.nil?
62:         raise InvalidReference, "Not attached to any PDF"
63:       end
64:       
65:       target = pdfdoc.get_object(self)
66:       
67:       if target.nil?
68:         raise InvalidReference, "Cannot resolve reference"
69:       end
70: 
71:       target
72:     end

Returns a Ruby array with the object number and the generation this reference is pointing to.

[Source]

    # File sources/parser/reference.rb, line 89
89:     def to_a
90:       [@refno, @refgen]
91:     end

[Source]

     # File sources/parser/obfuscation.rb, line 161
161:     def to_obfuscated_str
162:       refstr = refno.to_s + Obfuscator.junk_spaces + refgen.to_s + Obfuscator.junk_spaces + "R"
163: 
164:       print(refstr)
165:     end

Returns self.

[Source]

     # File sources/parser/reference.rb, line 100
100:     def value
101:       self
102:     end

[Validate]