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.
Source Code
54 | def initialize(title, parent, options) |
55 | @closed = options[:closed] |
56 | @title = title |
57 | @parent = parent |
58 | @count = 0 |
59 | 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.
Source Code
48 | def closed |
49 | @closed
|
50 | 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.
Source Code
13 | def count |
14 | @count
|
15 | 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.
Source Code
44 | def dest |
45 | @dest
|
46 | 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.
Source Code
17 | def first |
18 | @first
|
19 | 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.
Source Code
21 | def last |
22 | @last
|
23 | 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.
Source Code
25 | def next |
26 | @next
|
27 | 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.
Source Code
33 | def parent |
34 | @parent
|
35 | 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.
Source Code
29 | def prev |
30 | @prev
|
31 | 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.
Source Code
37 | def title |
38 | @title
|
39 | 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.
Source Code
64 | def to_hash |
65 | hash = { |
66 | Title: title, |
67 | Parent: parent, |
68 | Count: closed ? -count : count, |
69 | }
|
70 | [
|
71 | { First: first }, { Last: last }, { Next: defined?(@next) && @next }, |
72 | { Prev: prev }, { Dest: dest }, |
73 | ].each do |h| |
74 | unless h.values.first.nil? |
75 | hash.merge!(h) |
76 | end
|
77 | end
|
78 | hash
|
79 | end
|