Class: HexaPDF::Task::Dereference
- Inherits:
-
Object
- Object
- HexaPDF::Task::Dereference
- Defined in:
- lib/hexapdf/task/dereference.rb
Overview
Task for recursively dereferencing a single object or the reachable parts of the whole PDF document. Dereferencing means that the references are replaced with the actual objects.
Running this task is most often done to prepare for other steps in a PDF transformation process.
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
:nodoc:.
Class Method Summary collapse
-
.call(doc, object: nil) ⇒ Object
Recursively dereferences the reachable parts of the document and returns an array of objects that are never referenced.
Instance Method Summary collapse
-
#initialize(doc, object = nil) ⇒ Dereference
constructor
:nodoc:.
Constructor Details
#initialize(doc, object = nil) ⇒ Dereference
:nodoc:
59 60 61 62 63 64 65 |
# File 'lib/hexapdf/task/dereference.rb', line 59 def initialize(doc, object = nil) #:nodoc: @doc = doc @object = object @seen = {} @result = nil execute end |
Instance Attribute Details
#result ⇒ Object (readonly)
:nodoc:
57 58 59 |
# File 'lib/hexapdf/task/dereference.rb', line 57 def result @result end |
Class Method Details
.call(doc, object: nil) ⇒ Object
Recursively dereferences the reachable parts of the document and returns an array of objects that are never referenced. This includes indirect objects that are used as values for the /Length entry of a stream.
If the optional argument object
is provided, only the given object is dereferenced and nothing is returned.
53 54 55 |
# File 'lib/hexapdf/task/dereference.rb', line 53 def self.call(doc, object: nil) new(doc, object).result end |