File: outline_root.rb

package info (click to toggle)
ruby-pdf-core 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 408 kB
  • sloc: ruby: 2,270; makefile: 4
file content (33 lines) | stat: -rw-r--r-- 757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

module PDF
  module Core
    # Document Outline root.
    #
    # @api private
    # @see # PDF 1.7 spec, section 8.2.2 Document Outline
    class OutlineRoot
      # The total number of open items at all levels of the outline.
      # @return [Integer]
      attr_accessor :count

      # The first top-level item in the outline.
      # @return [Reference]
      attr_accessor :first

      # The last top-level item in the outline.
      # @return [Reference]
      attr_accessor :last

      def initialize
        @count = 0
      end

      # Hash representation of the outline root
      # @return [Hash]
      def to_hash
        { Type: :Outlines, Count: count, First: first, Last: last }
      end
    end
  end
end