File: subtable.rb

package info (click to toggle)
ruby-prawn 1.0.0~rc1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,248 kB
  • sloc: ruby: 17,499; sh: 44; makefile: 17
file content (65 lines) | stat: -rw-r--r-- 1,292 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# encoding: utf-8   

# subtable.rb: Yo dawg.
#
# Copyright January 2010, Brad Ediger. All Rights Reserved.
#
# This is free software. Please see the LICENSE and COPYING files for details.
module Prawn
  class Table
    class Cell

      # A Cell that contains another table.
      #
      class Subtable < Cell

        attr_reader :subtable

        def initialize(pdf, point, options={})
          super
          @subtable = options[:content]

          # Subtable padding defaults to zero
          @padding = [0, 0, 0, 0]
        end

        # Sets the text color of the entire subtable.
        #
        def text_color=(color)
          @subtable.cells.text_color = color
        end

        # Proxied to subtable.
        #
        def natural_content_width
          @subtable.cells.width
        end

        # Proxied to subtable.
        #
        def min_width
          @subtable.cells.min_width
        end

        # Proxied to subtable.
        #
        def max_width
          @subtable.cells.max_width
        end

        # Proxied to subtable. 
        #
        def natural_content_height
          @subtable.cells.height
        end

        # Draws the subtable.
        #
        def draw_content
          @subtable.draw
        end

      end
    end
  end
end