Class: PDF::Core::OutlineItem
- Inherits:
-
Object
- Object
- PDF::Core::OutlineItem
- Defined in:
- lib/pdf/core/outline_item.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#closed ⇒ Object
Returns the value of attribute closed.
-
#count ⇒ Object
Returns the value of attribute count.
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#first ⇒ Object
Returns the value of attribute first.
-
#last ⇒ Object
Returns the value of attribute last.
-
#next ⇒ Object
Returns the value of attribute next.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, parent, options) ⇒ OutlineItem
constructor
A new instance of OutlineItem.
- #to_hash ⇒ Object
Constructor Details
#initialize(title, parent, options) ⇒ OutlineItem
Returns a new instance of OutlineItem.
7 8 9 10 11 12 |
# File 'lib/pdf/core/outline_item.rb', line 7 def initialize(title, parent, ) @closed = [:closed] @title = title @parent = parent @count = 0 end |
Instance Attribute Details
#closed ⇒ Object
Returns the value of attribute closed.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def closed @closed end |
#count ⇒ Object
Returns the value of attribute count.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def count @count end |
#dest ⇒ Object
Returns the value of attribute dest.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def dest @dest end |
#first ⇒ Object
Returns the value of attribute first.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def first @first end |
#last ⇒ Object
Returns the value of attribute last.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def last @last end |
#next ⇒ Object
Returns the value of attribute next.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def next @next end |
#parent ⇒ Object
Returns the value of attribute parent.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def parent @parent end |
#prev ⇒ Object
Returns the value of attribute prev.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def prev @prev end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/pdf/core/outline_item.rb', line 4 def title @title end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pdf/core/outline_item.rb', line 14 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 |