class Origami::Reference
Class representing a Reference
Object
. Reference
are like symbolic links pointing to a particular object into the file.
Constants
- REGEXP_TOKEN
Attributes
refgen[RW]
refno[RW]
Public Class Methods
new(refno, refgen)
click to toggle source
Calls superclass method
Origami::Object::new
# File lib/origami/reference.rb, line 39 def initialize(refno, refgen) super() @refno, @refgen = refno, refgen end
Public Instance Methods
<=>(ref)
click to toggle source
# File lib/origami/reference.rb, line 81 def <=>(ref) #:nodoc self.to_a <=> ref.to_a end
==(ref)
click to toggle source
Compares to Reference
object.
# File lib/origami/reference.rb, line 88 def ==(ref) return false unless ref.is_a?(Reference) self.to_a == ref.to_a end
Also aliased as: eql?
solve()
click to toggle source
# File lib/origami/reference.rb, line 61 def solve doc = self.document if doc.nil? raise InvalidReferenceError, "Not attached to any document" end target = doc.get_object(self) if target.nil? and not Origami::OPTIONS[:ignore_bad_references] raise InvalidReferenceError, "Cannot resolve reference : #{self}" end target or Null.new end
to_a()
click to toggle source
Returns a Ruby array with the object number and the generation this reference is pointing to.
# File lib/origami/reference.rb, line 98 def to_a [@refno, @refgen] end
to_obfuscated_str()
click to toggle source
Calls superclass method
Origami::Object#to_obfuscated_str
# File lib/origami/obfuscation.rb, line 183 def to_obfuscated_str refstr = refno.to_s + Obfuscator.junk_spaces + refgen.to_s + Obfuscator.junk_spaces + "R" super(refstr) end
value()
click to toggle source
Returns the referenced object value.
# File lib/origami/reference.rb, line 109 def value self.solve.value end