Class: PDF::Core::OutlineItem Private
- Inherits:
-
Object
- Object
- PDF::Core::OutlineItem
- Defined in:
- lib/pdf/core/outline_item.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Outline item.
Instance Attribute Summary collapse
-
#closed ⇒ Boolean
private
Is this item open or closed.
-
#count ⇒ Integer
private
The total number of its open descendants at all lower levels of the outline hierarchy.
-
#dest ⇒ String, ...
private
The destination to be displayed when this item is activated.
-
#first ⇒ Reference<PDF::Core::OutlineItem>
private
The first of this item’s immediate children in the outline hierarchy.
-
#last ⇒ Reference<PDF::Core::OutlineItem>
private
The last of this item’s immediate children in the outline hierarchy.
-
#next ⇒ Reference<PDF::Core::OutlineItem>
private
The next item at this outline level.
-
#parent ⇒ Reference<[PDF::Core::OutlineItem, PDF::Core::OutlineRoot]>
private
The parent of this item in the outline hierarchy.
-
#prev ⇒ Reference<PDF::Core::OutlineItem>
private
The previous item at this outline level.
-
#title ⇒ String
private
The text to be displayed on the screen for this item.
Instance Method Summary collapse
-
#initialize(title, parent, options) ⇒ OutlineItem
constructor
private
A new instance of OutlineItem.
-
#to_hash ⇒ Hash
private
A hash representation of this outline item.
Constructor Details
#initialize(title, parent, options) ⇒ OutlineItem
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of OutlineItem.
54 55 56 57 58 59 |
# File 'lib/pdf/core/outline_item.rb', line 54 def initialize(title, parent, ) @closed = [:closed] @title = title @parent = parent @count = 0 end |
Instance Attribute Details
#closed ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Is this item open or closed.
48 49 50 |
# File 'lib/pdf/core/outline_item.rb', line 48 def closed @closed end |
#count ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The total number of its open descendants at all lower levels of the outline hierarchy.
13 14 15 |
# File 'lib/pdf/core/outline_item.rb', line 13 def count @count end |
#dest ⇒ String, ...
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The destination to be displayed when this item is activated.
44 45 46 |
# File 'lib/pdf/core/outline_item.rb', line 44 def dest @dest end |
#first ⇒ Reference<PDF::Core::OutlineItem>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The first of this item’s immediate children in the outline hierarchy.
17 18 19 |
# File 'lib/pdf/core/outline_item.rb', line 17 def first @first end |
#last ⇒ Reference<PDF::Core::OutlineItem>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The last of this item’s immediate children in the outline hierarchy.
21 22 23 |
# File 'lib/pdf/core/outline_item.rb', line 21 def last @last end |
#next ⇒ Reference<PDF::Core::OutlineItem>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The next item at this outline level.
25 26 27 |
# File 'lib/pdf/core/outline_item.rb', line 25 def next @next end |
#parent ⇒ Reference<[PDF::Core::OutlineItem, PDF::Core::OutlineRoot]>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The parent of this item in the outline hierarchy.
33 34 35 |
# File 'lib/pdf/core/outline_item.rb', line 33 def parent @parent end |
#prev ⇒ Reference<PDF::Core::OutlineItem>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The previous item at this outline level.
29 30 31 |
# File 'lib/pdf/core/outline_item.rb', line 29 def prev @prev end |
#title ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The text to be displayed on the screen for this item.
37 38 39 |
# File 'lib/pdf/core/outline_item.rb', line 37 def title @title end |
Instance Method Details
#to_hash ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A hash representation of this outline item.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/pdf/core/outline_item.rb', line 64 def to_hash hash = { Title: title, Parent: parent, Count: closed ? -count : count, } [ { First: first }, { Last: last }, { Next: defined?(@next) && @next }, { Prev: prev }, { Dest: dest }, ].each do |h| unless h.values.first.nil? hash.merge!(h) end end hash end |