Class: Pdfrb::Document::Destinations

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfrb/document/destinations.rb

Overview

Named-destinations facade (stub). Full implementation in TODO 129.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Destinations

Returns a new instance of Destinations.



9
10
11
# File 'lib/pdfrb/document/destinations.rb', line 9

def initialize(document)
  @document = document
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



7
8
9
# File 'lib/pdfrb/document/destinations.rb', line 7

def document
  @document
end

Instance Method Details

#[](name) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/pdfrb/document/destinations.rb', line 13

def [](name)
  names = document.catalog.value[:Names]
  return nil unless names.is_a?(::Hash) || names.is_a?(Pdfrb::Model::Cos::Dictionary)

  dests = names.is_a?(Pdfrb::Model::Cos::Dictionary) ? names.value[:Dests] : names[:Dests]
  dests ? dests[name] : nil
end