Class: Prawn::OutlineItem

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/outline.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, parent, options) ⇒ OutlineItem

Returns a new instance of OutlineItem.



305
306
307
308
309
310
# File 'lib/prawn/outline.rb', line 305

def initialize(title, parent, options)
  @closed = options[:closed]
  @title = title
  @parent = parent
  @count = 0
end

Instance Attribute Details

#closedObject

Returns the value of attribute closed.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def closed
  @closed
end

#countObject

Returns the value of attribute count.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def count
  @count
end

#destObject

Returns the value of attribute dest.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def dest
  @dest
end

#firstObject

Returns the value of attribute first.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def first
  @first
end

#lastObject

Returns the value of attribute last.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def last
  @last
end

#nextObject

Returns the value of attribute next.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def next
  @next
end

#parentObject

Returns the value of attribute parent.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def parent
  @parent
end

#prevObject

Returns the value of attribute prev.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def prev
  @prev
end

#titleObject

Returns the value of attribute title.



303
304
305
# File 'lib/prawn/outline.rb', line 303

def title
  @title
end

Instance Method Details

#to_hashObject



312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/prawn/outline.rb', line 312

def to_hash
  hash = { :Title => title,
           :Parent => parent,
           :Count => closed ? -count : count }
  [{:First => first}, {:Last => last}, {:Next => @next}, 
   {:Prev => prev}, {:Dest => dest}].each do |h|
    unless h.values.first.nil?
      hash.merge!(h)
    end
  end
  hash 
end