Class: PDFBeads::PDFBuilder::PDFTOC::PDFTOCItem

Inherits:
Hash
  • Object
show all
Defined in:
lib/pdfbeads/pdftoc.rb

Overview

This class represents a single TOC item with its parent node and next/previous siblings.

Instance Method Summary collapse

Instance Method Details

#getChildrenCountObject



59
60
61
62
63
64
65
66
67
# File 'lib/pdfbeads/pdftoc.rb', line 59

def getChildrenCount()
  cnt = self[:children].length
  self[:children].each do |child|
    if child[:open] and child[:children].length > 0
      cnt = cnt + child.getChildrenCount
    end
  end
  return cnt
end

#prevSibling(indent) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/pdfbeads/pdftoc.rb', line 69

def prevSibling( indent )
  if has_key? :parent and self[:indent] > indent
    return self[:parent].prevSibling( indent )
  end

  return self if self[:indent] == indent
  return nil
end